/* The KidStudy Blog: the post list (blog/index.html) and the articles.
   Builds on site.css (.ks-main, .ks-hero, .ks-card, .ks-button, .ks-note) and the
   brand tokens in brand.css. Each post wears its subject's colour through --tint. */

.ks-page *, .ks-page *::before, .ks-page *::after { box-sizing: border-box; }
.ks-page { margin: 0; }

/* Subject colours. --tint is the bright brand colour; --tint-ink is a darker shade
   that keeps text readable on white and on the pale wash. */
.tint-writing { --tint: var(--ks-writing); --tint-ink: #a3500c; --tint-button: #c96512; }
.tint-reading { --tint: var(--ks-reading); --tint-ink: #157a41; --tint-button: #1a8a4a; }
.tint-maths { --tint: var(--ks-maths); --tint-ink: #5f37b8; --tint-button: var(--ks-maths); }
.tint-science { --tint: var(--ks-science); --tint-ink: #0b7070; --tint-button: #0b7f7f; }
.tint-geography { --tint: var(--ks-geography); --tint-ink: #8f3f1d; --tint-button: var(--ks-geography); }
.tint-coding { --tint: var(--ks-coding); --tint-ink: #1a5f96; --tint-button: #1f6fae; }
.tint-health { --tint: var(--ks-health); --tint-ink: #a3204f; --tint-button: #c22f66; }
.tint-history { --tint: var(--ks-history); --tint-ink: #6f532c; --tint-button: var(--ks-history); }
.tint-music { --tint: var(--ks-music); --tint-ink: #8a2276; --tint-button: #9e2a87; }
.tint-family { --tint: var(--ks-blue); --tint-ink: #24498c; --tint-button: var(--ks-blue); }

.blog-tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tint, var(--ks-blue)) 14%, #fff);
  color: var(--tint-ink, var(--ks-blue));
  font: 600 14px/1.3 var(--ks-brand-font);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ---- Breadcrumbs ---- */

.blog-crumbs { margin: 0 0 14px; color: var(--muted); font-size: 15px; }
.blog-crumbs ol { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; }
.blog-crumbs li:not(:last-child)::after { content: '›'; margin-left: 6px; color: #9aa2b1; }
.blog-crumbs a { color: var(--ks-blue); font-weight: 600; text-decoration: none; }
.blog-crumbs a:hover { text-decoration: underline; }
.blog-crumbs [aria-current] { color: var(--muted); }

/* ---- The post list ---- */

.ks-main.blog-wide {
  max-width: 1080px;
  margin-inline: max(24px, calc((100% - 1080px) / 2));
}
.blog-wide .ks-hero { max-width: 820px; }
.blog-intro { max-width: 820px; margin: 0 0 22px; }
.blog-intro p { margin: 0; color: var(--muted); font-size: 17px; line-height: 1.55; }

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.blog-grid > li { display: flex; }

.post-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  overflow: hidden;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 1px 2px rgb(29 36 51 / 0.08), 0 8px 24px rgb(29 36 51 / 0.1);
  color: inherit;
  text-decoration: none;
  transition: box-shadow 0.2s, transform 0.2s;
}
.post-card-pic {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 150px;
  padding: 16px 18px 0 20px;
  overflow: hidden;
  background: color-mix(in srgb, var(--tint) 12%, #fff);
}
/* A circle of the subject's colour behind Kobi, as on the home page. */
.post-card-pic::before {
  content: '';
  position: absolute;
  right: -40px;
  bottom: -90px;
  width: 230px;
  height: 230px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--tint) 22%, #fff);
}
.post-card-pic .blog-tag { position: relative; align-self: flex-start; background: #fff; }
.post-card-pic img { position: relative; width: 118px; height: auto; margin-bottom: -6px; transition: transform 0.2s; }
.post-card-body { display: flex; flex: 1; flex-direction: column; padding: 18px 22px 20px; }
.post-card :is(h2, h3) { margin: 0 0 8px; color: var(--ink); font: 600 23px/1.2 var(--ks-brand-font); }
.post-card p { flex: 1; margin: 0 0 14px; color: var(--muted); font-size: 16px; line-height: 1.5; }
.post-meta { color: var(--muted); font-size: 14px; }
.post-meta .dot { margin: 0 6px; }
.post-card .post-more { margin-top: 10px; color: var(--tint-ink); font: 600 17px/1.2 var(--ks-brand-font); }
.post-card:focus-visible { outline: 3px solid var(--ks-blue); outline-offset: 3px; }
.post-card:active { transform: scale(0.98); }
@media (hover: hover) {
  .post-card:hover { box-shadow: 0 2px 4px rgb(29 36 51 / 0.1), 0 14px 32px rgb(29 36 51 / 0.16); }
  .post-card:hover img { transform: rotate(-4deg) translateY(-4px); }
  .post-card:hover :is(h2, h3) { color: var(--tint-ink); }
}

.blog-toc { margin-bottom: 8px; }

/* The list is grouped by subject, each with its own heading. */
.blog-section { margin-top: 30px; scroll-margin-top: 16px; }
.blog-section-title { margin: 0; color: var(--ks-blue); font: 600 28px/1.2 var(--ks-brand-font); }
.blog-section-blurb { margin: 4px 0 14px; color: var(--muted); font-size: 16px; }

.blog-about { margin-top: 26px; }
.blog-about p:last-child { margin-bottom: 0; }

/* ---- An article ---- */

.post-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 18px;
  margin-bottom: 18px;
}
.post-head h1 { margin: 10px 0 0; color: var(--ks-blue); font: 600 40px/1.12 var(--ks-brand-font); }
.post-head img { width: 132px; height: auto; }
.post-byline { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; margin-top: 12px; color: var(--muted); font-size: 15px; }
.post-byline .dot { margin: 0 8px; }
.post-byline b { color: var(--ink); font-weight: 600; }

.post-body > * { max-width: 68ch; }
.ks-card.post-body { font-size: 18px; line-height: 1.7; }
.post-body h2 { margin-top: 34px; }
.post-body p, .post-body ul, .post-body ol { margin-bottom: 16px; }
.post-body li { margin-bottom: 8px; }
.post-body li::marker { color: var(--tint, var(--ks-blue)); font-weight: 700; }
.post-body strong { color: var(--ink); }
.post-lead {
  margin: 0 0 22px !important;
  color: var(--ink);
  font-size: 21px;
  line-height: 1.55;
}

/* A boxed tip, with Kobi thinking. */
/* A quoted poem or passage, such as the Ode on Anzac Day. */
.post-body blockquote {
  margin: 20px 0;
  padding: 14px 20px;
  border-left: 4px solid var(--tint);
  border-radius: 0 14px 14px 0;
  background: color-mix(in srgb, var(--tint) 8%, #fff);
  font-size: 18px;
  font-style: italic;
  line-height: 1.6;
}
.post-body blockquote p { margin: 0; }

.post-tip {
  position: relative;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin: 24px 0;
  padding: 18px 20px;
  border-left: 6px solid var(--ks-sun);
  border-radius: 18px;
  background: #fff7e3;
}
.post-tip img { flex: none; width: 58px; height: auto; }
.post-tip-title { display: block; margin: 0 0 4px; color: #8a6200; font: 600 19px/1.25 var(--ks-brand-font); }
.post-tip p, .post-tip ul { margin: 0 0 8px; }
.post-tip > div > :last-child { margin-bottom: 0; }

/* A safety box: the same shape, in a firm red-orange. */
.post-tip.safety { border-left-color: #c2410c; background: #fff1ea; }
.post-tip.safety .post-tip-title { color: #9a3412; }

/* A small table (ages and stages, coins, what is taught when). */
.post-table-wrap { max-width: 100%; margin: 0 0 18px; overflow-x: auto; }
.post-table { width: 100%; border-collapse: collapse; font-size: 16px; line-height: 1.45; }
.post-table caption { margin-bottom: 6px; color: var(--muted); font-size: 15px; text-align: left; }
.post-table th, .post-table td { padding: 9px 12px; border-bottom: 1px solid #e3e7ef; text-align: left; vertical-align: top; }
.post-table thead th { background: color-mix(in srgb, var(--tint) 12%, #fff); color: var(--tint-ink); font: 600 16px/1.3 var(--ks-brand-font); }

/* Questions parents ask, at the end of a post. */
.post-faq h2 { margin-bottom: 12px; }
.post-faq p { margin-bottom: 0; }

/* Where the facts come from. */
.post-sources { margin-top: 30px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.post-sources h2 { margin: 0 0 8px; font-size: 19px; }
.post-sources ul { padding-left: 20px; }
.post-sources li { margin-bottom: 4px; }

/* Steps for an activity. */
.post-steps { counter-reset: step; padding-left: 0 !important; list-style: none; }
.post-steps > li { position: relative; padding-left: 44px; counter-increment: step; }
.post-steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 2px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--tint) 16%, #fff);
  color: var(--tint-ink);
  font: 600 16px/1 var(--ks-brand-font);
}

/* Try it on KidStudy. */
.post-cta {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 20px;
  margin: 18px 0 0;
  padding: 22px 26px;
  border-radius: 28px;
  background: color-mix(in srgb, var(--tint) 12%, #fff);
  border: 2px solid color-mix(in srgb, var(--tint) 30%, #fff);
}
.post-cta img { width: 112px; height: auto; }
.post-cta h2 { margin: 0 0 6px; color: var(--tint-ink); font: 600 26px/1.2 var(--ks-brand-font); }
.post-cta p { margin: 0 0 14px; font-size: 17px; line-height: 1.55; }
.post-cta .ks-button { background: var(--tint-button); }
.post-cta .ks-button:hover { filter: brightness(1.08); }

/* The related lesson: one lesson from the apps under each post, like a tile in the app.
   Its own tint is the lesson's subject, which may differ from the post's. */
.post-lesson { margin-top: 26px; }
.post-lesson > h2 { margin: 0 0 12px; color: var(--ks-blue); font: 600 26px/1.2 var(--ks-brand-font); }
.post-lesson-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 18px 22px;
  border-radius: 24px;
  background: #fff;
  border: 2px solid color-mix(in srgb, var(--tint) 35%, #fff);
  box-shadow: 0 6px 18px rgba(31, 52, 94, 0.08);
  color: inherit;
  text-decoration: none;
}
.post-lesson-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--tint) 16%, #fff);
  font-size: 40px;
  line-height: 1;
}
.post-lesson-text { display: grid; gap: 3px; min-width: 0; }
.post-lesson-kicker { color: var(--tint-ink); font: 600 15px/1.3 var(--ks-brand-font); }
.post-lesson-name { font: 600 23px/1.2 var(--ks-brand-font); }
.post-lesson-note { color: var(--muted); font-size: 16px; line-height: 1.45; }
.post-lesson-go {
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--tint-button);
  color: #fff;
  font: 600 17px/1.2 var(--ks-brand-font);
  white-space: nowrap;
}
@media (hover: hover) {
  .post-lesson-card:hover { border-color: var(--tint); }
  .post-lesson-card:hover .post-lesson-go { filter: brightness(1.08); }
}
.post-lesson-card:focus-visible { outline: 3px solid var(--ks-blue); outline-offset: 3px; }

/* Related posts. */
.post-related { margin-top: 30px; }
.post-related > h2 { margin: 0 0 12px; color: var(--ks-blue); font: 600 26px/1.2 var(--ks-brand-font); }
.post-related .blog-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.post-related .post-card-pic { height: 120px; }
.post-related .post-card-pic img { width: 92px; }
.post-related .post-card :is(h2, h3) { font-size: 21px; }

.post-back { margin: 24px 0 0; font-size: 16px; }
.post-back a { color: var(--ks-blue); font-weight: 600; }

/* ---- iPad portrait and phones ---- */

@media (max-width: 760px) {
  .ks-main.blog-wide { margin: 16px 14px 0; }
  .blog-grid { gap: 14px; }
  .post-card { border-radius: 24px; }
  .post-card-pic { height: 128px; }
  .post-card-pic img { width: 100px; }
  .post-card :is(h2, h3) { font-size: 21px; }
  .post-head { gap: 10px; }
  .post-head h1 { font-size: 29px; }
  .post-head img { width: 84px; }
  .ks-card.post-body { font-size: 17px; line-height: 1.65; }
  .post-lead { font-size: 19px; }
  .post-tip { padding: 14px 16px; gap: 10px; }
  .post-tip img { width: 44px; }
  .post-cta { grid-template-columns: 1fr; gap: 6px; padding: 20px 20px 22px; text-align: left; }
  .post-cta img { width: 84px; }
  .post-related > h2, .post-cta h2 { font-size: 23px; }
  .post-lesson-card { grid-template-columns: auto 1fr; gap: 14px; padding: 16px; }
  .post-lesson-icon { width: 60px; height: 60px; font-size: 34px; }
  .post-lesson-go { grid-column: 1 / -1; justify-self: start; }
  .post-lesson > h2 { font-size: 23px; }
  .blog-section-title { font-size: 24px; }
  .post-table { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .post-card, .post-card img { transition: none; }
  .post-card:hover img { transform: none; }
}

@media print {
  .post-cta, .post-lesson, .post-related, .blog-crumbs, .post-head img { display: none; }
  .ks-card { box-shadow: none; }
}
