/* 3.2: the Carefree Parenting section (front page and article pages).
   Colours, fonts, sizes and motion come only from tokens.css. Built on the site's own leaf, prose, form and button styles. */

/* nothing in the section moves, except the animated front page */
.leaf.cp-still { animation: none; }

/* ------------------------------------------------------------ shared */
.cp-meta {
  margin: 0;
  font-size: var(--size-sm);
  line-height: var(--lh-ui);
  color: var(--ink-soft);
}
.cp-meta a { color: var(--ink-soft); }
.cp-meta a:hover { color: var(--vermilion); }
.cp-wrap > * { max-width: var(--cp-list-max); margin-inline: auto; }

/* ------------------------------------------------------------ front page: masthead */
.cp-masthead { text-align: center; }
.cp-masthead__title {
  font-size: var(--cp-size-masthead);
  line-height: var(--lh-tight);
  margin: 0;
}
.cp-masthead__line {
  display: block;
  width: var(--cp-masthead-line-w);
  height: var(--wordmark-line-h);
  margin: var(--space-xs) auto 0;
  overflow: visible;
}
.cp-masthead__line path {
  fill: none;
  stroke: var(--gold);
  stroke-width: var(--wordmark-stroke);
  stroke-linecap: round;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 0;
}
.cp-masthead__tagline {
  margin: var(--space-md) auto 0;
  max-width: var(--measure);
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--size-h3);
  line-height: var(--lh-heading);
  color: var(--ink-soft);
  text-wrap: balance;
}
.cp-masthead .cloud-rule { margin-block: var(--space-xl); }

/* ------------------------------------------------------------ front page: latest article */
.cp-latest {
  position: relative;
  max-width: var(--cp-latest-max);
  margin: 0 auto var(--space-xl);
  padding: var(--space-lg) var(--space-xl);
  background-color: var(--paper);
  border: var(--rule-fine) solid var(--vermilion);
  border-radius: var(--radius-xs);
  text-align: center;
}
.cp-latest::after {
  content: "";
  position: absolute;
  inset: var(--space-2xs);
  border: var(--rule-hair) solid var(--gold);
  pointer-events: none;
}
.cp-latest__label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  margin: 0 0 var(--space-sm);
  font-size: var(--size-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  color: var(--vermilion);
}
.cp-latest__bud { width: var(--cp-bud-size); height: var(--cp-bud-size); flex: none; }
.cp-latest__title {
  font-size: var(--cp-size-latest);
  margin: 0 auto var(--space-2xs);
  max-width: none;
  text-wrap: balance;
}
.cp-latest__title a { color: var(--ink); text-decoration: none; }
.cp-latest__title a:hover { color: var(--vermilion); }
.cp-latest__excerpt {
  max-width: var(--measure);
  margin: var(--space-sm) auto 0;
  font-size: var(--size-ui);
  color: var(--ink-soft);
}
.cp-latest__more { margin: var(--space-sm) 0 0; position: relative; z-index: 1; font-size: var(--size-sm); font-weight: var(--weight-semibold); }
.cp-latest[hidden] { display: none; }

/* ------------------------------------------------------------ front page: topics */
.cp-topics { text-align: center; }
.cp-topics__label {
  margin: 0 0 var(--space-sm);
  font-family: var(--font-text);
  font-size: var(--size-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  color: var(--ink-soft);
}
.cp-topics__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-xs);
}
.cp-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  min-height: var(--touch-min);
  padding: var(--space-2xs) var(--space-md);
  border: var(--rule-hair) solid var(--ink-rule);
  border-radius: var(--radius-pill);
  background-color: var(--sheet);
  color: var(--ink);
  font-size: var(--size-sm);
  line-height: var(--lh-ui);
  text-decoration: none;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.cp-chip:hover { border-color: var(--vermilion); color: var(--vermilion); }
.cp-chip__n { font-size: var(--size-xs); color: var(--ink-soft); }
.cp-chip[aria-current="true"] { background-color: var(--teal-deep); border-color: var(--teal-deep); color: var(--sheet); }
.cp-chip[aria-current="true"] .cp-chip__n { color: var(--gold-soft); }

.cp-count {
  margin: var(--space-lg) auto var(--space-md);
  text-align: center;
  font-size: var(--size-sm);
  font-style: italic;
  color: var(--ink-soft);
}

/* ------------------------------------------------------------ front page: the list */
.cp-month { margin-top: var(--space-xl); }
.cp-month[hidden] { display: none; }
.cp-month__title {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: var(--size-h3);
  margin: 0 0 var(--space-xs);
  max-width: none;
}
.cp-month__title::after {
  content: "";
  flex: 1;
  height: var(--rule-hair);
  background-color: var(--gold-rule);
}
.cp-month__list { list-style: none; margin: 0; padding: 0; }
.cp-item {
  display: grid;
  grid-template-columns: var(--cp-date-col) minmax(0, 1fr);
  gap: var(--space-md);
  align-items: baseline;
  padding: var(--space-sm) 0;
  border-bottom: var(--rule-hair) solid var(--ink-hairline);
}
.cp-item[hidden] { display: none; }
.cp-item__date {
  font-size: var(--size-xs);
  letter-spacing: var(--track-lead-caps);
  text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
}
.cp-item__body { min-width: 0; line-height: var(--lh-heading); }
.cp-item__title {
  font-family: var(--font-display);
  font-size: var(--cp-size-item);
  line-height: var(--lh-heading);
  color: var(--ink);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.cp-item__title:hover { color: var(--vermilion); text-decoration: underline; text-decoration-thickness: var(--rule-hair); }
.cp-item .cp-meta { margin-top: var(--space-3xs); font-size: var(--size-xs); }

/* ------------------------------------------------------------ article pages */
.cp-reading { max-width: var(--measure); margin-inline: auto; }
.cp-reading .back-nav { max-width: none; }
.cp-kicker {
  margin: 0 0 var(--space-xs);
  font-size: var(--size-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
}
.cp-kicker a { color: var(--vermilion); text-decoration: none; }
.cp-kicker a:hover { text-decoration: underline; }
.cp-article__title { margin-bottom: var(--space-sm); overflow-wrap: anywhere; }
.cp-article__head { margin-bottom: var(--space-xl); padding-bottom: var(--space-lg); border-bottom: var(--rule-hair) solid var(--gold-rule); }
.cp-article__body { overflow-wrap: break-word; }
.cp-article__body .block--text,
.cp-article__body .block--list,
.cp-article__body .prose { max-width: none; }
.cp-article__body .prose p { margin: 0 0 var(--space-md); }
.cp-article__body .block--heading { font-size: var(--size-h3); margin: var(--space-xl) 0 var(--space-sm); }
.cp-article__body .block--quote { margin: var(--space-lg) 0; padding-left: var(--space-lg); border-left: var(--rule-bold) solid var(--gold); }
.cp-article__body .block--list { margin-bottom: var(--space-md); }
.cp-article__body .block--list li + li { margin-top: var(--space-2xs); }
.cp-article__body u { text-decoration-color: var(--gold-deep); text-decoration-thickness: var(--rule-fine); text-underline-offset: var(--underline-offset); }
.cp-article__body sup { line-height: 0; }
.block--divider { display: flex; justify-content: center; margin: var(--space-lg) 0; }
.block--divider svg { width: var(--cp-divider-w); height: auto; }
.block--photo-small .ruled-frame { max-width: var(--cp-photo-small-max); }
.block--photo-small .ruled-frame img { width: 100%; height: auto; }

.cp-pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-2xl);
  padding-top: var(--space-lg);
  border-top: var(--rule-hair) solid var(--gold-rule);
}
.cp-pager__link { display: grid; gap: var(--space-3xs); text-decoration: none; color: var(--ink); min-width: 0; }
.cp-pager__link--newer { text-align: right; grid-column: 2; }
.cp-pager__dir { font-size: var(--size-xs); letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--teal); }
.cp-pager__title { font-family: var(--font-display); font-size: var(--size-ui); line-height: var(--lh-heading); overflow-wrap: anywhere; }
.cp-pager__link:hover .cp-pager__title { color: var(--vermilion); text-decoration: underline; text-decoration-thickness: var(--rule-hair); }

/* ------------------------------------------------------------ comments */
.cp-comments { max-width: var(--measure); margin-inline: auto; }
.leaf__section + .cp-comments { margin-top: 0; }
.cp-comments .cloud-rule { margin-block: var(--space-2xl) var(--space-xl); }
.cp-comments__top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-xs) var(--space-md); margin-bottom: var(--space-md); }
.cp-comments__title { font-size: var(--size-h2); margin: 0; }
.cp-comments__jump { font-size: var(--size-sm); font-weight: var(--weight-semibold); }
.cp-comments__n { color: var(--ink-soft); font-size: var(--size-h3); }
.cp-respond {
  position: relative;
  scroll-margin-top: var(--scroll-pad-desktop);
  margin: var(--space-2xl) 0 0;
  padding: var(--space-lg) var(--space-xl);
  background-color: var(--paper);
  border: var(--rule-fine) solid var(--vermilion);
  border-radius: var(--radius-xs);
}
.cp-respond::after {
  content: "";
  position: absolute;
  inset: var(--space-2xs);
  border: var(--rule-hair) solid var(--gold);
  pointer-events: none;
}
.cp-respond .form-stack { position: relative; z-index: 1; }
.cp-respond__title { font-size: var(--size-h3); margin-bottom: var(--space-sm); }
.cp-form { max-width: none; }
.cp-form__notice { margin: 0; font-size: var(--size-sm); line-height: var(--lh-ui); color: var(--ink-soft); }
.cp-form__replying { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm); font-size: var(--size-sm); font-weight: var(--weight-semibold); color: var(--teal-deep); }
.cp-form__replying[hidden] { display: none; }
.cp-form__cancel {
  min-height: var(--touch-min);
  padding: 0 var(--space-sm);
  border: var(--rule-hair) solid var(--ink-rule);
  border-radius: var(--radius-pill);
  background-color: var(--sheet);
  font-family: var(--font-text);
  font-size: var(--size-xs);
  color: var(--ink);
  cursor: pointer;
}
.cp-form__cancel:hover { border-color: var(--vermilion); color: var(--vermilion); }
.cp-reply {
  margin: var(--space-3xs) 0 0;
  padding: var(--space-2xs) 0;
  border: 0;
  background: none;
  font-family: var(--font-text);
  font-size: var(--size-xs);
  color: var(--teal);
  text-decoration-line: underline;
  text-decoration-thickness: var(--rule-hair);
  text-underline-offset: var(--underline-offset);
  cursor: pointer;
}
.cp-reply:hover { color: var(--vermilion); }
.cp-reply[hidden] { display: none; }
.cp-none { color: var(--ink-soft); font-style: italic; }

.cp-thread { list-style: none; margin: 0; padding: 0; }
.cp-thread > .cp-comment + .cp-comment { margin-top: var(--space-lg); }
.cp-thread--replies {
  margin: var(--space-md) 0 0 var(--cp-reply-indent);
  padding-left: var(--cp-reply-indent);
  border-left: var(--rule-fine) solid var(--gold-rule);
}
.cp-thread--replies > .cp-comment + .cp-comment { margin-top: var(--space-md); }
.cp-comment__card { padding-bottom: var(--space-md); border-bottom: var(--rule-hair) solid var(--ink-hairline); scroll-margin-top: var(--scroll-pad-desktop); }
.cp-comment__card--author {
  padding: var(--space-md);
  background-color: var(--paper);
  border: var(--rule-hair) solid var(--paper-edge);
  border-radius: var(--radius-xs);
}
.cp-comment__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2xs) var(--space-sm); }
.cp-comment__name { font-weight: var(--weight-semibold); font-size: var(--size-ui); overflow-wrap: anywhere; }
.cp-badge {
  padding: 0 var(--space-xs);
  border-radius: var(--radius-pill);
  background-color: var(--gold-soft);
  color: var(--ink);
  font-size: var(--size-2xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--track-lead-caps);
  text-transform: uppercase;
}
.cp-comment__date { font-size: var(--size-xs); color: var(--ink-soft); text-decoration: none; }
.cp-comment__date:hover { color: var(--vermilion); text-decoration: underline; }
.cp-comment__context { display: none; margin: var(--space-3xs) 0 0; font-size: var(--size-xs); font-style: italic; color: var(--ink-soft); }
.cp-comment__text { font-size: var(--size-ui); line-height: var(--lh-body); overflow-wrap: anywhere; }
.cp-comment__text p { margin: var(--space-xs) 0 0; }
.cp-comment:target > .cp-comment__card { background-color: var(--target-glow-bg); }

/* phones: two levels of replies; deeper replies line up with the second level and say whom they answer */
@media (max-width: 600px) {
  .cp-latest { padding: var(--space-lg) var(--space-md) var(--space-md); }
  .cp-item { grid-template-columns: minmax(0, 1fr); gap: 0; padding: var(--space-xs) 0; }
  .cp-topics__list {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    margin-inline: calc(var(--space-md) * -1);
    padding: 0 var(--space-md) var(--space-2xs);
    -webkit-mask-image: linear-gradient(to right, var(--ink), var(--ink) calc(100% - var(--space-xl)), var(--transparent));
    mask-image: linear-gradient(to right, var(--ink), var(--ink) calc(100% - var(--space-xl)), var(--transparent));
  }
  .cp-topics__list::-webkit-scrollbar { display: none; }
  .cp-topics__list li { flex: none; scroll-snap-align: start; }
  .cp-pager { grid-template-columns: minmax(0, 1fr); }
  .cp-pager__link--newer { grid-column: 1; text-align: left; }
  .cp-respond { padding: var(--space-md); scroll-margin-top: var(--scroll-pad-mobile); }
  .cp-latest__title { font-size: var(--size-h3); }
  .cp-comment__card { scroll-margin-top: var(--scroll-pad-mobile); }
  .cp-thread--replies .cp-thread--replies { margin-left: 0; padding-left: 0; border-left: 0; }
  .cp-comment__context { display: block; }
}

/* ------------------------------------------------------------ the animated front page: moves once, when it opens */
@media (prefers-reduced-motion: no-preference) {
  .cp-front--animated:not(.cp-settled) .cp-masthead__title { animation: cp-rise var(--t-cp-rise) var(--ease-silk) var(--t-cp-d1) both; }
  .cp-front--animated:not(.cp-settled) .cp-masthead__line path { animation: cp-draw var(--t-cp-draw) var(--ease) var(--t-cp-d2) both; }
  .cp-front--animated:not(.cp-settled) .cp-masthead__tagline { animation: cp-fade var(--t-cp-fade) var(--ease) var(--t-cp-d3) both; }
  .cp-front--animated:not(.cp-settled) .cp-masthead .cloud-rule path:nth-child(1) { animation: cp-drift-left var(--t-cp-rise) var(--ease-silk) var(--t-cp-d3) both; }
  .cp-front--animated:not(.cp-settled) .cp-masthead .cloud-rule path:nth-child(2),
  .cp-front--animated:not(.cp-settled) .cp-masthead .cloud-rule path:nth-child(3) { animation: cp-fade var(--t-cp-rise) var(--ease) var(--t-cp-d3) both; }
  .cp-front--animated:not(.cp-settled) .cp-masthead .cloud-rule path:nth-child(4) { animation: cp-drift-right var(--t-cp-rise) var(--ease-silk) var(--t-cp-d3) both; }
  .cp-front--animated:not(.cp-settled) .cp-latest { animation: cp-rise var(--t-cp-rise) var(--ease-silk) var(--t-cp-d4) both; }
  .cp-front--animated:not(.cp-settled) .cp-latest__bud { transform-origin: 50% 90%; animation: cp-bloom var(--t-cp-bloom) var(--ease-silk) var(--t-cp-d4) both; }
  .cp-front--animated:not(.cp-settled) .cp-topics__label { animation: cp-fade var(--t-cp-fade) var(--ease) var(--t-cp-d5) both; }
  .cp-front--animated:not(.cp-settled) .cp-topics__list li { animation: cp-fade var(--t-cp-fade) var(--ease) calc(var(--t-cp-d5) + var(--t-cp-step) * var(--cp-n, 0)) both; }
  .cp-front--animated:not(.cp-settled) .cp-topics__list li:nth-child(2) { --cp-n: 1; }
  .cp-front--animated:not(.cp-settled) .cp-topics__list li:nth-child(3) { --cp-n: 2; }
  .cp-front--animated:not(.cp-settled) .cp-topics__list li:nth-child(4) { --cp-n: 3; }
  .cp-front--animated:not(.cp-settled) .cp-topics__list li:nth-child(5) { --cp-n: 4; }
  .cp-front--animated:not(.cp-settled) .cp-topics__list li:nth-child(6) { --cp-n: 5; }
  .cp-front--animated:not(.cp-settled) .cp-topics__list li:nth-child(7) { --cp-n: 6; }
  .cp-front--animated:not(.cp-settled) .cp-topics__list li:nth-child(8) { --cp-n: 7; }
  .cp-front--animated:not(.cp-settled) .cp-topics__list li:nth-child(9) { --cp-n: 8; }
  .cp-front--animated:not(.cp-settled) .cp-topics__list li:nth-child(10) { --cp-n: 9; }
  .cp-front--animated:not(.cp-settled) .cp-topics__list li:nth-child(11) { --cp-n: 10; }
  .cp-front--animated:not(.cp-settled) .cp-topics__list li:nth-child(n+12) { --cp-n: 11; }
  .cp-front--animated:not(.cp-settled) .cp-count { animation: cp-fade var(--t-cp-fade) var(--ease) var(--t-cp-d6) both; }
  .cp-front--animated:not(.cp-settled) .cp-month:first-child .cp-month__title { animation: cp-fade var(--t-cp-fade) var(--ease) var(--t-cp-d6) both; }
  .cp-front--animated:not(.cp-settled) .cp-month:first-child .cp-item { animation: cp-rise var(--t-cp-rise) var(--ease-silk) calc(var(--t-cp-d6) + var(--t-cp-step) * var(--cp-n, 0)) both; }
  .cp-front--animated:not(.cp-settled) .cp-month:first-child .cp-item:nth-child(2) { --cp-n: 1; }
  .cp-front--animated:not(.cp-settled) .cp-month:first-child .cp-item:nth-child(3) { --cp-n: 2; }
  .cp-front--animated:not(.cp-settled) .cp-month:first-child .cp-item:nth-child(4) { --cp-n: 3; }
  .cp-front--animated:not(.cp-settled) .cp-month:first-child .cp-item:nth-child(5) { --cp-n: 4; }
  .cp-front--animated:not(.cp-settled) .cp-month:first-child .cp-item:nth-child(n+6) { --cp-n: 5; }
}
@keyframes cp-rise { from { opacity: 0; transform: translateY(var(--cp-rise)); } to { opacity: 1; transform: none; } }
@keyframes cp-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cp-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes cp-drift-left { from { opacity: 0; transform: translateX(calc(var(--cp-drift) * -1)); } to { opacity: 1; transform: none; } }
@keyframes cp-drift-right { from { opacity: 0; transform: translateX(var(--cp-drift)); } to { opacity: 1; transform: none; } }
@keyframes cp-bloom { 0% { opacity: 0; transform: scale(0.4); } 70% { opacity: 1; transform: scale(1.12); } 100% { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ 3.2 stage 1b: carefreeparenting.com's header panel
   A wide framed panel at the top of the home page; the picture is drawn by assets/js/cp-hero.js (animated or still). */
.cp-hero {
  position: relative;
  max-width: var(--cp-hero-max);
  margin: 0 auto var(--leaf-outer-y);
  aspect-ratio: var(--cp-hero-ratio);
  background: var(--teal-wash);
  border: var(--rule-ornament) solid var(--vermilion);
  border-radius: var(--radius-xs);
  overflow: hidden;
  box-shadow: var(--shadow-leaf);
}
.cp-hero__art { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cp-hero__frame {
  position: absolute;
  inset: var(--cp-hero-inset);
  border: var(--rule-hair) solid var(--gold);
  pointer-events: none;
}
.cp-hero__cusp {
  position: absolute;
  top: calc(-1 * var(--cp-hero-inset) - var(--rule-hair));
  width: var(--space-2xl);
  height: var(--space-2xl);
  pointer-events: none;
}
.cp-hero__cusp svg { display: block; width: 100%; height: 100%; }
.cp-hero__cusp--left { left: calc(-1 * var(--cp-hero-inset) - var(--rule-hair)); }
.cp-hero__cusp--right { right: calc(-1 * var(--cp-hero-inset) - var(--rule-hair)); transform: scaleX(-1); }
.cp-hero__btn {
  position: absolute;
  right: var(--space-md);
  bottom: var(--space-md);
  width: var(--cp-hero-btn);
  height: var(--cp-hero-btn);
  display: grid;
  place-items: center;
  padding: 0;
  border: var(--rule-fine) solid var(--gold);
  border-radius: var(--radius-pill);
  background: var(--sound-btn-bg);
  color: var(--gold-soft);
  cursor: pointer;
  opacity: 0.88;
  transition: opacity var(--t-cp-hero-btn) var(--ease), background-color var(--t-cp-hero-btn) var(--ease);
}
.cp-hero__btn:hover { opacity: 1; background: var(--sound-btn-bg-hover); }
.cp-hero__btn:focus-visible { outline: var(--focus-width) solid var(--focus-ring-dark); outline-offset: var(--focus-offset); }
.cp-hero__btn svg { width: var(--cp-hero-icon); height: var(--cp-hero-icon); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cp-hero__btn .cp-hero__icon-play path { fill: currentColor; }
.cp-hero__btn g { display: none; }
.cp-hero__btn[data-state="playing"] .cp-hero__icon-pause,
.cp-hero__btn[data-state="paused"] .cp-hero__icon-play,
.cp-hero__btn[data-state="done"] .cp-hero__icon-replay { display: inline; }
@media (max-width: 1100px) { .cp-hero { aspect-ratio: var(--cp-hero-ratio-tablet); } }
@media (max-width: 767px) {
  .cp-hero { aspect-ratio: var(--cp-hero-ratio-mobile); margin-bottom: var(--space-lg); }
  .cp-hero__btn { right: var(--space-sm); bottom: var(--space-sm); }
}
/* the site header's wordmark on carefreeparenting.com keeps the main site's look; the home page has no extra motion */
.cp-home .cp-front { margin-top: 0; }
