/* ---------- Tokens ---------- */
:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --ink: #0e0e0e;
  --ink-2: #4a4a4a;
  --ink-3: #8a8a8a;
  --line: #e4e2dd;
  --chip: #ecebe7;
  --done: #15803d;
  --done-bg: #e7f5ec;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
  --shadow-lg: 0 2px 6px rgba(0,0,0,.06), 0 18px 48px rgba(0,0,0,.12);
  --radius: 18px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0c0c;
    --surface: #161616;
    --ink: #f3f3f1;
    --ink-2: #b4b4b0;
    --ink-3: #7a7a77;
    --line: #262626;
    --chip: #1f1f1f;
    --done: #4ade80;
    --done-bg: #12261a;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
    --shadow-lg: 0 2px 6px rgba(0,0,0,.5), 0 18px 48px rgba(0,0,0,.6);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .container { padding: 0 28px; } }

.eyebrow {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  max-width: 1180px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
@media (min-width: 720px) { .topbar__inner { padding: 14px 28px; } }
.brand { font-weight: 800; font-size: 17px; color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.brand span { color: var(--ink-3); margin-left: 2px; }
.progress { display: flex; align-items: center; gap: 12px; }
.progress__label { font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.progress__label b { color: var(--ink); }
.progress__track { width: 120px; height: 6px; background: var(--chip); border-radius: 99px; overflow: hidden; }
.progress__fill { height: 100%; width: 0; background: var(--ink); border-radius: 99px; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.progress.is-complete .progress__fill { background: var(--done); }
@media (max-width: 420px) { .progress__track { width: 64px; } }

/* ---------- Hero ---------- */
.hero { padding-top: 64px; padding-bottom: 36px; text-align: center; }
.hero h1 {
  margin: 0 auto;
  max-width: 900px;
  font-size: clamp(36px, 7vw, 72px);
  line-height: 1.02;
  letter-spacing: -.045em;
  font-weight: 800;
}
.hero__sub {
  margin: 20px auto 0;
  max-width: 560px;
  font-size: clamp(16px, 2.2vw, 19px);
  color: var(--ink-2);
}
.hero__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 28px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  height: 50px; padding: 0 22px;
  border: 1px solid var(--line); border-radius: 99px;
  background: var(--surface); color: var(--ink);
  font-size: 15px; font-weight: 700; text-decoration: none;
  transition: border-color .2s, transform .15s, box-shadow .2s;
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { border-color: var(--ink); box-shadow: var(--shadow); }
.btn:active { transform: scale(.97); }
.btn--dark { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.br-desk { display: none; }
@media (min-width: 720px) { .br-desk { display: inline; } }

.howto {
  list-style: none; padding: 0; margin: 32px auto 0;
  display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px;
  font-size: 14px; font-weight: 600; color: var(--ink-2);
}
.howto li { display: flex; align-items: center; gap: 8px; }
.howto span {
  display: grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--ink); color: var(--bg);
  font-size: 11px; font-weight: 800;
}

/* ---------- Filters ---------- */
.filters {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
  padding-top: 8px; padding-bottom: 32px;
}
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 99px;
  font-size: 14px; font-weight: 600;
  transition: background .2s, color .2s, border-color .2s;
}
.chip em { font-style: normal; font-size: 12px; color: var(--ink-3); }
.chip:hover { border-color: var(--ink-3); }
.chip.is-active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.is-active em { color: color-mix(in srgb, var(--bg) 60%, transparent); }

/* ---------- Grid & cards ---------- */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  padding-bottom: 72px;
}
@media (min-width: 640px)  { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 24px; } }

.card {
  position: relative;
  display: flex; flex-direction: column;
  text-align: left;
  padding: 0; border: 1px solid var(--line);
  color: inherit; text-decoration: none;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .35s;
  opacity: 0; transform: translateY(16px);
}
.card.is-visible { opacity: 1; transform: none; }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.card.is-hidden { display: none; }

.card__img { position: relative; aspect-ratio: 16 / 9; background: var(--chip); overflow: hidden; }
.card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.8,.2,1); }
.card:hover .card__img img { transform: scale(1.04); }

.card__num { color: var(--ink); font-weight: 800; margin-right: 6px; }
.card__check {
  position: absolute; bottom: 12px; right: 12px;
  height: 30px; padding: 0 12px;
  display: none; align-items: center; gap: 6px;
  background: var(--done); color: #fff;
  border-radius: 99px; font-size: 12px; font-weight: 700;
}
.card.is-learned .card__check { display: inline-flex; }

.card__body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card__meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.card__title { margin: 0; font-size: 19px; line-height: 1.25; font-weight: 800; letter-spacing: -.02em; }
.card__lead { margin: 0; font-size: 14.5px; color: var(--ink-2); }
.card__more { margin-top: auto; padding-top: 8px; font-size: 13px; font-weight: 700; color: var(--ink); }
.card__more::after { content: " →"; transition: margin .2s; }
.card:hover .card__more::after { margin-left: 4px; }

.level { display: inline-flex; align-items: center; gap: 6px; }
.level::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.level[data-l="Beginner"]     { color: #15803d; }
.level[data-l="Intermediate"] { color: #b45309; }
.level[data-l="Advanced"]     { color: #b91c1c; }
@media (prefers-color-scheme: dark) {
  .level[data-l="Beginner"]     { color: #4ade80; }
  .level[data-l="Intermediate"] { color: #fbbf24; }
  .level[data-l="Advanced"]     { color: #f87171; }
}

/* ---------- Closing ---------- */
.closing { padding-bottom: 56px; }
.closing__box {
  max-width: 760px; margin: 0 auto;
  padding: 40px 28px;
  background: var(--ink); color: var(--bg);
  border-radius: 24px;
  text-align: center;
}
.closing__box .eyebrow { color: color-mix(in srgb, var(--bg) 55%, transparent); }
.closing__box h2 { margin: 0 0 24px; font-size: clamp(26px, 4.5vw, 38px); line-height: 1.1; letter-spacing: -.03em; }
.rules { list-style: none; padding: 0; margin: 0 auto; max-width: 480px; text-align: left; display: grid; gap: 12px; }
.rules li { padding: 14px 18px; border-radius: 14px; background: color-mix(in srgb, var(--bg) 8%, transparent); font-size: 15px; }
.rules b { display: inline-block; min-width: 72px; }
.closing .note { margin: 24px 0 0; font-size: 14px; color: color-mix(in srgb, var(--bg) 60%, transparent); }

.footer { padding-bottom: 40px; text-align: center; font-size: 13px; color: var(--ink-3); }

/* ---------- Modal ---------- */
.modal {
  width: min(760px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0; border: 0;
  border-radius: 22px;
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: none; flex-direction: column;
}
.modal[open] { display: flex; animation: pop .35s cubic-bezier(.2,.8,.2,1); }
.modal::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(4px); animation: fade .3s; }
@keyframes pop  { from { opacity: 0; transform: translateY(20px) scale(.98); } }
@keyframes fade { from { opacity: 0; } }

.modal__media { position: relative; aspect-ratio: 16 / 9; max-height: 38dvh; width: 100%; background: var(--chip); flex-shrink: 0; }
.modal__media img { width: 100%; height: 100%; object-fit: cover; }
.modal__close {
  position: absolute; top: 12px; right: 12px;
  width: 38px; height: 38px; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.95); color: #0e0e0e;
  font-size: 15px; font-weight: 700;
}

.modal__body { padding: 24px 24px 8px; overflow-y: auto; flex: 1; min-height: 0; }
@media (min-width: 720px) { .modal__body { padding: 28px 36px 8px; } }
.modal__meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; font-weight: 700; }
.num { padding: 4px 10px; border-radius: 99px; background: var(--ink); color: var(--bg); }
.tag { padding: 4px 10px; border-radius: 99px; background: var(--chip); color: var(--ink-2); }
.modal h2 { margin: 14px 0 8px; font-size: clamp(24px, 4vw, 32px); line-height: 1.12; letter-spacing: -.03em; }
.modal__lead { margin: 0 0 24px; font-size: 16.5px; color: var(--ink-2); }

.block { margin-bottom: 22px; }
.block h3 { margin: 0 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.steps { list-style: none; counter-reset: s; padding: 0; margin: 0; display: grid; gap: 10px; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; font-size: 15px; }
.steps li::before {
  content: counter(s);
  flex-shrink: 0; width: 24px; height: 24px; margin-top: 1px;
  display: grid; place-items: center;
  border-radius: 50%; border: 1.5px solid var(--ink);
  font-size: 12px; font-weight: 800;
}
.two { display: grid; gap: 0 28px; }
@media (min-width: 560px) { .two { grid-template-columns: 1fr 1fr; } }
.tools { display: flex; flex-wrap: wrap; gap: 6px; }
.tools span { padding: 6px 12px; border-radius: 99px; background: var(--chip); font-size: 13px; font-weight: 600; }
.earn { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -.01em; }

.tip {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 16px 18px; margin-bottom: 20px;
  border-radius: 14px;
  background: var(--bg); border: 1px dashed var(--line);
  font-size: 15px;
}
.tip__icon { flex-shrink: 0; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: var(--bg); font-weight: 800; font-size: 13px; }

.modal__foot {
  display: flex; gap: 10px; align-items: center;
  padding: 14px 24px 18px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}
@media (min-width: 720px) { .modal__foot { padding: 16px 36px 20px; } }
.nav-btn {
  width: 48px; height: 48px; flex-shrink: 0;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); font-size: 18px; font-weight: 700;
  transition: border-color .2s;
}
.nav-btn:hover { border-color: var(--ink); }
.nav-btn:disabled { opacity: .3; cursor: default; border-color: var(--line); }
.learn-btn {
  flex: 1; height: 48px;
  border: 0; border-radius: 14px;
  background: var(--ink); color: var(--bg);
  font-weight: 700; font-size: 15px;
  transition: background .2s, transform .1s;
}
.learn-btn:active { transform: scale(.98); }
.learn-btn.is-learned { background: var(--done-bg); color: var(--done); }

body.modal-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .card { opacity: 1; transform: none; }
}
