/* The KidStudy home page: Kobi says hello, then one big card per subject,
   two by two on an iPad, stacked on a phone. Brand colours are in brand.css. */

@font-face { font-family: 'Andika'; src: url('../fonts/andika.woff2') format('woff2'); font-display: swap; }

:root {
  color-scheme: light;
  --bg: #f6f3ec;
  --ink: #1d2433;
  --muted: #5b6577;
  --line: #e4dfd4;
  --shadow: 0 1px 2px rgb(29 36 51 / 0.08), 0 8px 24px rgb(29 36 51 / 0.1);
  --ui: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --book: 'Andika', var(--ui);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 8%, color-mix(in srgb, var(--ks-sun) 16%, transparent) 0 180px, transparent 181px),
    radial-gradient(circle at 92% 30%, color-mix(in srgb, var(--ks-reading) 10%, transparent) 0 140px, transparent 141px),
    var(--bg);
  color: var(--ink);
  font: 18px/1.4 var(--ui);
  -webkit-tap-highlight-color: transparent;
}

.home-head {
  max-width: 1000px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 24px 0;
  font-size: 34px;
}

/* ---- Kobi says hello ---- */

.hello {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 1000px;
  margin: 0 auto;
  padding: 8px 24px 0;
}
.kobi { flex: none; width: 190px; height: auto; animation: wave-in 0.7s ease-out both; }
.bubble {
  position: relative;
  max-width: 520px;
  padding: 20px 26px;
  border-radius: 28px;
  background: #fff;
  box-shadow: var(--shadow);
}
/* The bubble's tail points at Kobi. */
.bubble::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 42px;
  border: 14px solid transparent;
  border-left: 0;
  border-right-color: #fff;
}
.bubble h1 { margin: 0; color: var(--ks-blue); font: 600 40px/1.1 var(--ks-brand-font); }
.bubble p { margin: 6px 0 0; font: 400 26px/1.3 var(--book); }
.bubble .for-grownups { margin-top: 10px; color: var(--muted); font: 16px/1.4 var(--ui); }

@keyframes wave-in { from { transform: translateY(16px) scale(0.92); opacity: 0; } }

/* ---- The subjects ---- */

.sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: 20px;
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 24px 16px;
}

.section {
  --tint: var(--ks-blue);
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr auto;
  grid-template-areas: 'name pic' 'note pic' 'go pic';
  column-gap: 12px;
  row-gap: 8px;
  min-height: 210px;
  padding: 24px 18px 22px 26px;
  overflow: hidden;
  border-radius: 28px;
  background: #fff;
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
}
/* A wash of the subject's colour behind Kobi. */
.section::before {
  content: '';
  position: absolute;
  right: -60px;
  bottom: -70px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--tint) 15%, #fff);
}
.writing { --tint: var(--ks-writing); }
.reading { --tint: var(--ks-reading); }
.maths { --tint: var(--ks-maths); }
.science { --tint: var(--ks-science); }
.geography { --tint: var(--ks-geography); }
.coding { --tint: var(--ks-coding); }
.health { --tint: var(--ks-health); }
.history { --tint: var(--ks-history); }
.music { --tint: var(--ks-music); }

.section-pic { grid-area: pic; position: relative; align-self: end; width: 150px; height: auto; }
.section-name { grid-area: name; color: var(--tint); font: 600 40px/1.05 var(--ks-brand-font); }
.section-note { grid-area: note; position: relative; color: var(--muted); }
.section-go {
  grid-area: go;
  position: relative;
  justify-self: start;
  padding: 10px 22px;
  border-radius: 999px;
  background: var(--tint);
  color: #fff;
  font: 600 19px/1.2 var(--ks-brand-font);
}
/* Orange and teal are light behind white text, so their buttons go a shade darker. */
.writing .section-go { background: #c96512; }
.science .section-go { background: #0b7f7f; }

a.section:active { transform: scale(0.97); }

/* ---- More to explore: the subjects after the first four, smaller cards ---- */

.more { max-width: 1000px; margin: 0 auto; padding: 8px 24px 16px; }
.more h2 { margin: 0 0 12px; font: 600 26px/1.2 var(--ks-brand-font); }
.more-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 14px; }
.subject {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "pic name" "pic note";
  align-content: center;
  column-gap: 14px;
  min-height: 116px;
  padding: 10px 16px 10px 10px;
  overflow: hidden;
  border-left: 6px solid var(--tint);
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
}
.subject-pic { grid-area: pic; align-self: end; width: 86px; height: auto; }
.subject-name { grid-area: name; align-self: end; color: var(--tint); font: 600 26px/1.1 var(--ks-brand-font); }
.subject-note { grid-area: note; align-self: start; color: var(--muted); font-size: 15px; line-height: 1.3; }
/* Brown and terracotta read well; the lighter ones go a shade darker as text. */
.coding .subject-name { color: #1f6fae; }
.health .subject-name { color: #b8325f; }
.music .subject-name { color: #9c2a86; }
a.subject:active { transform: scale(0.97); }
@media (hover: hover) {
  a.subject:hover { box-shadow: 0 2px 4px rgb(29 36 51 / 0.1), 0 14px 32px rgb(29 36 51 / 0.16); }
}
@media (max-width: 600px) {
  .more { padding: 4px 14px 12px; }
  .more h2 { font-size: 22px; }
  .subject { min-height: 96px; }
  .subject-pic { width: 70px; }
  .subject-name { font-size: 22px; }
}
@media (hover: hover) {
  a.section:hover { box-shadow: 0 2px 4px rgb(29 36 51 / 0.1), 0 14px 32px rgb(29 36 51 / 0.16); }
  a.section:hover .section-pic { transform: rotate(-4deg) translateY(-4px); transition: transform 0.2s; }
}

.home-foot {
  max-width: 1000px;
  margin: 0 auto;
  padding: 8px 24px max(28px, env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 15px;
  text-align: center;
}
.home-foot .wordmark { font-size: 1.1em; }

/* ---- Phones ---- */

@media (max-width: 600px) {
  .home-head { padding: max(14px, env(safe-area-inset-top)) 16px 0; font-size: 28px; }
  .hello { gap: 0; padding: 4px 12px 0; }
  .kobi { width: 118px; }
  .bubble { padding: 14px 16px; border-radius: 22px; }
  .bubble::before { top: 28px; }
  .bubble h1 { font-size: 28px; }
  .bubble p { font-size: 19px; }
  .bubble .for-grownups { font-size: 14px; }
  .sections { gap: 14px; padding: 16px 14px 12px; }
  .section { min-height: 170px; padding: 18px 10px 18px 20px; border-radius: 24px; }
  .section::before { width: 200px; height: 200px; right: -50px; bottom: -60px; }
  .section-pic { width: 112px; }
  .section-name { font-size: 32px; }
  .section-note { font-size: 15px; }
  .section-go { padding: 9px 18px; font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .kobi { animation: none; }
}

/* ---- For grown-ups: backups, installing, the About page (js/grownups.js) ----
   Quiet on purpose: below the cards, small type, so it doesn't call to a child. */

.grownups {
  max-width: 952px;
  margin: 8px max(24px, calc((100% - 952px) / 2)) 8px;
  padding: 18px 22px;
  border-radius: 22px;
  background: rgb(255 255 255 / 0.6);
  border: 2px solid var(--line);
  font: 16px/1.45 var(--ui);
}
.grownups h2 { margin: 0 0 10px; color: var(--muted); font: 600 20px/1.2 var(--ks-brand-font); }
.gu-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.gu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 18px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ks-blue);
  font: 600 16px/1.2 var(--ui);
  text-decoration: none;
  cursor: pointer;
}
.gu-btn.primary { border-color: var(--ks-blue); background: var(--ks-blue); color: #fff; }
.gu-btn:active { transform: scale(0.97); }
.gu-status { margin: 0; }
.gu-status:not(:empty) { margin-top: 10px; }
.gu-status.ok { color: #1a7a43; }
.gu-status.error { color: #b3261e; }
.gu-confirm {
  margin-top: 12px;
  padding: 14px 18px;
  border-left: 6px solid var(--ks-blue);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
}
.gu-confirm:focus { outline: none; }
.gu-confirm-title { margin: 0 0 6px; font-weight: 700; }
.gu-changes { margin: 0 0 8px; padding-left: 22px; }
.gu-now, .gu-note { color: var(--muted); }
.gu-note { margin: 0 0 12px; font-size: 15px; }
.gu-tip { margin: 14px 0 0; color: var(--muted); font-size: 15px; }
.share-icon { width: 1em; height: 1.2em; vertical-align: -0.25em; fill: none; stroke: var(--ks-blue); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 600px) {
  .grownups { margin: 4px 14px 8px; padding: 14px 16px; }
  .gu-btn { flex: 1 1 auto; }
}

/* ---- Promises to families, under Kobi's hello ---- */

.promises {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  max-width: 1000px;
  margin: 18px auto 0;
  padding: 0 24px;
  list-style: none;
}
.promises li {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 12px 8px;
  border-radius: 18px;
  background: rgb(255 255 255 / 0.85);
  box-shadow: 0 1px 2px rgb(29 36 51 / 0.06);
  text-align: center;
}
.promises span { font: 24px/1.2 "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.promises b { font: 600 16px/1.2 var(--ks-brand-font); }
.promises small { color: var(--muted); font-size: 13px; line-height: 1.3; }

/* ---- Made for children, trusted by grown-ups ---- */

.parents { max-width: 1000px; margin: 12px auto 0; padding: 0 24px; }
.parents h2 { margin: 18px 0 14px; color: var(--ks-blue); font: 600 30px/1.15 var(--ks-brand-font); text-align: center; }
.parents-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.parent-card { padding: 18px 18px 20px; border-radius: 24px; background: #fff; box-shadow: var(--shadow); }
.parent-card img { display: block; width: 76px; height: 76px; object-fit: contain; margin-bottom: 6px; }
.parent-card h3 { margin: 0 0 6px; font: 600 20px/1.2 var(--ks-brand-font); }
.parent-card p { margin: 0; color: var(--muted); font-size: 15.5px; line-height: 1.45; }
.parent-card a, .parents-more a { color: var(--ks-blue); }
.parents-more { margin: 16px 0 0; text-align: center; font-weight: 600; }

/* Links for parents to the pages they look for most. */
.popular { margin: 22px auto 0; max-width: 860px; text-align: center; }
.popular h3 { margin: 0 0 10px; font: 600 20px/1.2 var(--ks-brand-font); }
.popular ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 10px; margin: 0; padding: 0; list-style: none; }
.popular a { display: inline-block; padding: 8px 14px; border-radius: 20px; background: #fff; box-shadow: var(--shadow); color: var(--ks-blue); font-weight: 600; text-decoration: none; }
.popular a:hover { text-decoration: underline; }

/* ---- For teachers: what is inside by year, and how children are kept safe ---- */

.teachers { max-width: 1000px; margin: 28px auto 0; padding: 0 24px; scroll-margin-top: 80px; }
.teachers h2 { margin: 0 0 8px; color: var(--ks-blue); font: 600 30px/1.15 var(--ks-brand-font); text-align: center; }
.teachers-lead { max-width: 760px; margin: 0 auto 16px; color: var(--muted); font-size: 17px; line-height: 1.5; text-align: center; }
.teachers-lead b { color: var(--ink); }
.teachers-table-wrap { overflow-x: auto; border-radius: 24px; background: #fff; box-shadow: var(--shadow); }
.teachers-table { width: 100%; border-collapse: collapse; font-size: 15.5px; line-height: 1.4; }
.teachers-table caption { padding: 16px 18px 4px; text-align: left; font: 600 20px/1.2 var(--ks-brand-font); }
.teachers-table th, .teachers-table td { padding: 10px 18px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
.teachers-table thead th { border-top: 0; color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.teachers-table tbody th { font-weight: 600; }
.teachers-table td:nth-child(2) { white-space: nowrap; color: var(--ks-blue); font-weight: 600; }
.teachers-table td:last-child { color: var(--muted); }
.teachers-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); gap: 16px; margin-top: 16px; }
.teacher-card { padding: 18px 18px 20px; border-top: 6px solid var(--ks-blue); border-radius: 24px; background: #fff; box-shadow: var(--shadow); }
.teacher-card h3 { margin: 0 0 8px; font: 600 20px/1.2 var(--ks-brand-font); }
.teacher-card ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 15.5px; line-height: 1.45; }
.teacher-card li + li { margin-top: 6px; }
.teacher-card b { color: var(--ink); }
.teacher-card a, .teachers-note a { color: var(--ks-blue); }
.teachers-note { max-width: 820px; margin: 16px auto 0; color: var(--muted); font-size: 14.5px; line-height: 1.5; text-align: center; }

@media (max-width: 600px) {
  .teachers { padding: 0 14px; }
  .teachers h2 { font-size: 24px; }
  .teachers-lead { font-size: 15.5px; }
  .teachers-table { font-size: 14.5px; }
  .teachers-table th, .teachers-table td { padding: 8px 12px; }
  .teachers-table caption { padding: 14px 12px 4px; font-size: 18px; }
  .teachers-table td:nth-child(2) { white-space: normal; }
  .teacher-card { padding: 14px; border-radius: 20px; }
  .teacher-card ul { font-size: 14.5px; }
}

@media (max-width: 860px) {
  .promises { gap: 8px; }
  .promises li { padding: 10px 6px; }
  .promises b { font-size: 14.5px; }
  .promises small { font-size: 12px; }
  .parents-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .promises { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .promises { grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; padding: 0 14px; }
  .promises li:last-child { grid-column: 1 / -1; }
  .parents { padding: 0 14px; }
  .parents h2 { font-size: 24px; }
  .parents-grid { gap: 12px; }
  .parent-card { padding: 14px; border-radius: 20px; }
  .parent-card img { width: 60px; height: 60px; }
  .parent-card h3 { font-size: 18px; }
  .parent-card p { font-size: 14.5px; }
}

/* ---- Today: one thing to try in each subject (js/today.js) ----
   Under Kobi's hello, big enough for a child to tap, quiet enough to ignore. */

.today { max-width: 1000px; margin: 16px auto 0; padding: 0 24px; }
.today h2 { margin: 0 0 10px; color: var(--ks-blue); font: 600 26px/1.15 var(--ks-brand-font); }
.today-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 0; padding: 0; list-style: none; }
.today-list li { display: flex; min-width: 0; }
.today-item {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  min-height: 84px;
  padding: 12px 14px;
  border-left: 6px solid var(--tint);
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
}
.today-item:active { transform: scale(0.97); }
.today-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--tint) 15%, #fff);
  font: 26px/1 "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.today-text { display: grid; gap: 1px; min-width: 0; }
.today-subject { color: var(--tint); font: 600 14px/1.2 var(--ks-brand-font); }
.writing .today-subject { color: #c96512; }
.science .today-subject { color: #0b7f7f; }
.coding .today-subject { color: #1f6fae; }
.health .today-subject { color: #b8325f; }
.music .today-subject { color: #9c2a86; }
.today-title { font: 600 18px/1.2 var(--ks-brand-font); overflow-wrap: anywhere; }
.today-note { color: var(--muted); font-size: 14px; line-height: 1.3; }

@media (max-width: 1000px) {
  .today-list { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .today { margin-top: 12px; padding: 0 14px; }
  .today h2 { font-size: 22px; margin-bottom: 8px; }
  .today-list { gap: 8px; }
  .today-item { gap: 8px; min-height: 76px; padding: 10px; border-left-width: 5px; border-radius: 16px; }
  .today-icon { width: 38px; height: 38px; font-size: 21px; }
  .today-title { font-size: 16px; }
  .today-note { font-size: 13px; }
}
