/* ============================================================
   styles.css — site theme (home + browse pages)
   ============================================================ */
:root {
  --bg: #f6f8fc;
  --card: #ffffff;
  --ink: #1f2733;
  --muted: #65718a;
  --line: #e2e8f2;
  --brand: #3b6ef0;
  --brand-dark: #2b54c4;
  --accent: #ff8a3d;
  --radius: 16px;
  --shadow: 0 6px 22px rgba(31, 51, 92, 0.08);
  --shadow-hover: 0 12px 30px rgba(31, 51, 92, 0.16);
  --maxw: 1140px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; gap: 18px;
  height: 66px;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.25rem; color: var(--ink); }
.logo:hover { text-decoration: none; }
.logo .mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, var(--brand), #7048e8);
  color: #fff; display: grid; place-items: center; font-size: 20px; font-weight: 700;
}
.logo .mark span { transform: translateY(-1px); }
.nav { margin-left: auto; display: flex; align-items: center; gap: 22px; }
.nav a { color: var(--muted); font-weight: 600; }
.nav a:hover { color: var(--ink); text-decoration: none; }
.nav .btn { color: #fff; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--brand); color: #fff; font-weight: 700;
  padding: 10px 18px; border-radius: 999px; border: 0; cursor: pointer;
  font-size: 0.95rem; transition: transform .08s ease, background .15s ease;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; transform: translateY(-1px); }
.btn.ghost { background: #eef2fb; color: var(--brand-dark); }
.btn.ghost:hover { background: #e3e9f8; }
.menu-toggle { display: none; background: none; border: 0; font-size: 26px; cursor: pointer; color: var(--ink); }

/* ---------- hero ---------- */
.hero {
  background:
    radial-gradient(1100px 380px at 85% -10%, #e7edff 0, rgba(231,237,255,0) 60%),
    radial-gradient(900px 360px at 0% 0%, #fff1e6 0, rgba(255,241,230,0) 55%);
  padding: 64px 0 40px;
}
.hero h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); line-height: 1.1; margin: 0 0 14px; letter-spacing: -0.5px; }
.hero p.lead { font-size: 1.18rem; color: var(--muted); max-width: 640px; margin: 0 0 26px; }
.hero .cta-row { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .btn.lg { padding: 14px 26px; font-size: 1.05rem; }

.searchbar {
  margin-top: 26px; display: flex; gap: 8px; max-width: 560px;
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 6px 6px 18px; box-shadow: var(--shadow);
}
.searchbar input { flex: 1; border: 0; outline: 0; font-size: 1rem; background: transparent; color: var(--ink); }
.searchbar .btn { padding: 10px 20px; }

.stats { display: flex; gap: 30px; margin-top: 30px; flex-wrap: wrap; }
.stats .stat { display: flex; flex-direction: column; }
.stats .stat b { font-size: 1.5rem; }
.stats .stat span { color: var(--muted); font-size: .92rem; }

/* ---------- sections ---------- */
section.block { padding: 52px 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.section-head h2 { font-size: 1.7rem; margin: 0; letter-spacing: -0.3px; }
.section-head p { margin: 6px 0 0; color: var(--muted); }
.section-head a.more { font-weight: 700; }

/* ---------- grade pills ---------- */
.grade-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.grade-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 14px; text-align: center; box-shadow: var(--shadow);
  transition: transform .1s ease, box-shadow .15s ease; color: var(--ink);
}
.grade-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); text-decoration: none; }
.grade-card .g-num {
  width: 46px; height: 46px; margin: 0 auto 8px; border-radius: 12px;
  background: linear-gradient(135deg, #e7edff, #f3e8ff); color: var(--brand-dark);
  display: grid; place-items: center; font-weight: 800; font-size: 1.15rem;
}
.grade-card .g-label { font-weight: 700; font-size: .98rem; }
.grade-card .g-sub { color: var(--muted); font-size: .8rem; }

/* ---------- topic cards ---------- */
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.topic-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); display: flex; gap: 14px; align-items: flex-start;
  transition: transform .1s ease, box-shadow .15s ease; color: var(--ink);
}
.topic-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); text-decoration: none; }
.topic-card .t-ico {
  flex: 0 0 auto; width: 50px; height: 50px; border-radius: 13px;
  display: grid; place-items: center; font-size: 24px; color: #fff;
}
.topic-card h3 { margin: 0 0 3px; font-size: 1.05rem; }
.topic-card p { margin: 0; color: var(--muted); font-size: .88rem; }
.topic-card .t-count { color: var(--muted); font-size: .8rem; font-weight: 600; margin-top: 6px; }

/* ---------- worksheet cards ---------- */
.ws-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.ws-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .1s ease, box-shadow .15s ease;
}
.ws-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.ws-thumb {
  height: 124px; display: flex; align-items: center; justify-content: center;
  font-size: 46px; color: #fff; position: relative;
}
.ws-thumb .thumb-grade {
  position: absolute; top: 10px; right: 10px; background: rgba(255,255,255,.9);
  color: var(--ink); font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px;
}
.ws-body { padding: 15px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.ws-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ws-body .ws-topic { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.level-pill { display: inline-block; color: #fff; font-size: .68rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .03em; padding: 3px 9px; border-radius: 999px; white-space: nowrap; vertical-align: middle; }
.ws-body h3 { margin: 5px 0 6px; font-size: 1.02rem; line-height: 1.25; }
.ws-body p { margin: 0 0 14px; color: var(--muted); font-size: .85rem; flex: 1; }
.ws-actions { display: flex; gap: 8px; }
.ws-actions .btn { flex: 1; justify-content: center; padding: 9px 10px; font-size: .9rem; }
.btn.block { width: 100%; justify-content: center; margin-top: auto; }

/* ---------- how it works ---------- */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.step .num { width: 40px; height: 40px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; margin-bottom: 12px; }
.step h3 { margin: 0 0 6px; }
.step p { margin: 0; color: var(--muted); font-size: .92rem; }

/* ---------- browse page ---------- */
.browse-head { padding: 34px 0 8px; }
.browse-head h1 { margin: 0 0 6px; font-size: 2rem; }
.browse-head p { margin: 0; color: var(--muted); }
.filters { display: flex; flex-direction: column; gap: 14px; margin: 22px 0 6px; }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-label { font-weight: 700; font-size: .85rem; color: var(--muted); width: 64px; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 7px 14px; border-radius: 999px; font-size: .88rem; font-weight: 600;
  cursor: pointer; transition: all .12s ease;
}
.chip:hover { border-color: var(--brand); }
.chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.browse-search {
  display: flex; gap: 8px; max-width: 420px; background: #fff;
  border: 1px solid var(--line); border-radius: 10px; padding: 4px 4px 4px 14px; align-items: center;
}
.browse-search input { flex: 1; border: 0; outline: 0; font-size: .95rem; background: transparent; padding: 8px 0; }
.results-meta { color: var(--muted); margin: 18px 0 14px; font-size: .92rem; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }

/* ---------- legal pages (privacy / terms) ---------- */
.legal { max-width: 780px; }
.legal h1 { font-size: 2rem; margin: 0 0 4px; }
.legal .updated { color: var(--muted); margin: 0 0 26px; }
.legal h2 { font-size: 1.12rem; margin: 28px 0 6px; }
.legal p { color: var(--ink); line-height: 1.7; margin: 0 0 10px; }
.legal ul { color: var(--ink); line-height: 1.7; margin: 0 0 10px; padding-left: 20px; }
.legal ul li { margin-bottom: 6px; }
.legal a { word-break: break-word; }

/* ---------- footer ---------- */
.site-footer { background: #fff; border-top: 1px solid var(--line); margin-top: 30px; padding: 40px 0 30px; }
.footer-cols { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 24px; }
.footer-cols h4 { font-size: .95rem; margin: 0 0 12px; }
.footer-cols ul { list-style: none; padding: 0; margin: 0; }
.footer-cols ul li { margin-bottom: 8px; }
.footer-cols a { color: var(--muted); font-size: .9rem; }
.footer-note { color: var(--muted); font-size: .85rem; max-width: 280px; }
.footer-bottom { border-top: 1px solid var(--line); margin-top: 26px; padding-top: 18px; color: var(--muted); font-size: .82rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .nav { position: absolute; top: 66px; left: 0; right: 0; background: #fff; flex-direction: column;
    align-items: stretch; gap: 0; padding: 8px 0; border-bottom: 1px solid var(--line); display: none; }
  .nav.open { display: flex; }
  .nav a { padding: 12px 20px; }
  .nav .btn { margin: 8px 20px; justify-content: center; }
  .menu-toggle { display: block; margin-left: auto; }
  .footer-cols { grid-template-columns: 1fr 1fr; }
}
