/*
 * Shared styling for the Mayfield Grammar School CS tools site.
 * Used by index.html (category chooser) and each year-group page.
 */
:root {
  /* Palette sampled from the school's aster-flower crest */
  --navy: #2b3a67;
  --blue: #486090;
  --steel: #6078a8;
  --lilac: #7b7bc4;
  --purple: #9078d8;
  --ink: #1f2540;
  --muted: #5b6480;
  --line: #e2e5f0;
  --card: #ffffff;
  --radius: 18px;
  --shadow: 0 18px 40px rgba(43, 58, 103, 0.12);
  --shadow-hover: 0 24px 54px rgba(43, 58, 103, 0.20);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% -5%, rgba(144, 120, 216, 0.18), transparent 42%),
    radial-gradient(circle at 92% 6%, rgba(72, 96, 144, 0.16), transparent 40%),
    #f5f6fb;
  display: flex;
  flex-direction: column;
}

/* ── Header ───────────────────────────────── */
header {
  background: linear-gradient(135deg, var(--navy), var(--blue) 60%, var(--steel));
  color: #fff;
  padding: 2.4rem 1.5rem 3.6rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 40px;
  background: #f5f6fb;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  transform: scaleX(1.6);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  position: relative;
  z-index: 1;
  color: inherit;
  text-decoration: none;
}
.brand img {
  width: 64px;
  height: 64px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}
.brand .name {
  text-align: left;
}
.brand .name h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.brand .name span {
  font-size: 0.9rem;
  opacity: 0.85;
  font-weight: 500;
}
header .lede {
  position: relative;
  z-index: 1;
  margin: 1.4rem auto 0;
  max-width: 42rem;
  font-size: 1.05rem;
  opacity: 0.92;
}

/* ── Main ─────────────────────────────────── */
main {
  flex: 1;
  width: 100%;
  max-width: 62rem;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}
.section-label {
  text-align: center;
  margin: 0.5rem 0 1.8rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
}

/* Back link shown on year-group pages */
.back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.4rem 0 1.4rem;
  color: var(--blue);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}
.back:hover { color: var(--purple); }
.back .arrow { transition: transform 0.18s ease; }
.back:hover .arrow { transform: translateX(-4px); }

.tools {
  display: grid;
  /* Cards cap out at 26rem and centre, so a page with one tool looks the
     same as a page with four. */
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 26rem));
  justify-content: center;
  gap: 1.5rem;
}

.tool {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.6rem;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.tool:hover, .tool:focus-visible {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--lilac);
  outline: none;
}
.tool .icon {
  width: 52px;
  height: 52px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  margin-bottom: 1rem;
  color: #fff;
}
/* Category cards (landing page) */
.tool.year9 .icon  { background: linear-gradient(135deg, var(--blue), var(--steel)); }
.tool.gcse .icon   { background: linear-gradient(135deg, var(--purple), var(--lilac)); }
/* Individual tools */
.tool.python .icon { background: linear-gradient(135deg, var(--blue), var(--steel)); }
.tool.missions .icon { background: linear-gradient(135deg, var(--navy), var(--steel)); }
.tool.erl .icon    { background: linear-gradient(135deg, var(--purple), var(--lilac)); }
.tool.quest .icon  { background: linear-gradient(135deg, var(--navy), var(--purple)); }
.tool.playground .icon { background: linear-gradient(135deg, var(--steel), var(--lilac)); }
.tool h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}
.tool .tag {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--blue);
  background: rgba(72, 96, 144, 0.1);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  margin-bottom: 0.8rem;
}
.tool p {
  color: var(--muted);
  font-size: 0.95rem;
  flex: 1;
}
/* List of the tools inside a category, shown on the landing page */
.tool .contents {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0.9rem 0 0;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
  color: var(--muted);
}
.tool .contents li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.15rem 0;
}
.tool .contents li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lilac);
  flex: none;
}
.tool .cta {
  margin-top: 1.2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  color: var(--navy);
}
.tool:hover .cta { color: var(--purple); }
.tool .cta .arrow { transition: transform 0.18s ease; }
.tool:hover .cta .arrow { transform: translateX(4px); }

/* ── Footer ───────────────────────────────── */
footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--line);
}
footer a { color: var(--blue); }
