/* ==========================================================================
   Latest posts — homepage teaser grid, fed from content/blog by build.js
   ========================================================================== */
.latest-posts {
  padding: clamp(2.4rem, 6vw, 4.2rem) 0;
}

.latest-posts__head {
  max-width: 60ch;
  margin: 0 auto clamp(1.8rem, 4vw, 2.6rem);
  text-align: center;
}

.latest-posts__eyebrow {
  display: inline-block;
  margin-bottom: 0.7rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: rgba(30, 122, 84, 0.1);
  color: var(--colour-accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.latest-posts__title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4.4vw, 3rem);
  line-height: 1.05;
  color: var(--colour-text);
}

.latest-posts__intro {
  margin-top: 0.9rem;
  color: var(--colour-muted);
  font-size: 1.08rem;
}

/* Carousel — scroll/swipe, resting on full slides (matches quick wins) */
.latest-posts__carousel {
  position: relative;
}

.latest-posts__viewport {
  overflow: hidden;
}

.latest-posts__list {
  --lp-per: 3;
  --lp-gap: clamp(1.6rem, 3vw, 2.4rem);
  list-style: none;
  display: flex;
  gap: var(--lp-gap);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  /* top padding leaves room for the pushpins; bottom for the drop shadow */
  padding: 14px 0 6px;
}

.latest-posts__list::-webkit-scrollbar {
  display: none;
}

.lp-card {
  display: flex;
  flex: 0 0 calc((100% - (var(--lp-per) - 1) * var(--lp-gap)) / var(--lp-per));
  scroll-snap-align: start;
}

/* Pinned post-it note — matches the /blog grid */
.lp-card__note {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 2rem 1.5rem 1.5rem;
  color: #2a2620;
  background-image: linear-gradient(180deg, var(--note-hi) 0%, var(--note) 58%, var(--note-lo) 100%);
  border-radius: 3px;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.12),
    0 14px 24px -16px rgba(20, 23, 38, 0.5);
  transform: rotate(var(--tilt, -1deg));
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.lp-card__note:hover {
  transform: rotate(0deg) translateY(-3px);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.14),
    0 24px 32px -18px rgba(20, 23, 38, 0.5);
}

/* Pushpin */
.lp-card__note::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  width: 20px;
  height: 20px;
  transform: translateX(-50%);
  border-radius: 50%;
  pointer-events: none;
  background:
    radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 42%),
    linear-gradient(180deg,
      color-mix(in srgb, var(--pin) 76%, #fff) 0%,
      var(--pin) 36%,
      color-mix(in srgb, var(--pin) 58%, #000) 82%,
      color-mix(in srgb, var(--pin) 42%, #000) 100%);
  box-shadow:
    0 5px 7px -2px rgba(0, 0, 0, 0.45),
    inset 0 2px 2px rgba(255, 255, 255, 0.35),
    inset 0 -3px 4px rgba(0, 0, 0, 0.3);
  z-index: 3;
}

.lp-card:nth-child(4n+1) .lp-card__note { --note-hi: var(--colour-postit-hi); --note: var(--colour-postit); --note-lo: var(--colour-postit-lo); --pin: #e5384d; --tilt: -1.5deg; }
.lp-card:nth-child(4n+2) .lp-card__note { --note-hi: var(--postit-blue-hi); --note: var(--postit-blue); --note-lo: var(--postit-blue-lo); --pin: #ff7a1a; --tilt: 1.3deg; }
.lp-card:nth-child(4n+3) .lp-card__note { --note-hi: var(--postit-pink-hi); --note: var(--postit-pink); --note-lo: var(--postit-pink-lo); --pin: #12a594; --tilt: -0.9deg; }
.lp-card:nth-child(4n+4) .lp-card__note { --note-hi: var(--postit-green-hi); --note: var(--postit-green); --note-lo: var(--postit-green-lo); --pin: #8b3ff0; --tilt: 1.6deg; }

.lp-card__meta {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.8rem;
}

.lp-card__tag {
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.1);
  color: rgba(0, 0, 0, 0.72);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.lp-card__date {
  color: rgba(0, 0, 0, 0.55);
  font-size: 0.85rem;
}

.lp-card__title {
  font-family: var(--font-heading);
  font-size: 1.42rem;
  line-height: 1.14;
  color: #2a2620;
}

.lp-card__excerpt {
  margin-top: 0.55rem;
  color: rgba(0, 0, 0, 0.7);
  font-size: 0.96rem;
  line-height: 1.5;
}

.lp-card__cta {
  align-self: flex-start;
  margin-top: auto;
  padding-top: 1.2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  font-size: 0.9rem;
  color: #1c1a15;
  text-decoration: none;
}

.lp-card__cta > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 50%;
  background: #1c1a15;
  color: #fff;
  font-size: 0.9rem;
  line-height: 1;
  transition: transform 0.2s ease, background 0.2s ease;
}

.lp-card__cta:hover,
.lp-card__cta:focus {
  text-decoration: none;
}

.lp-card__note:hover .lp-card__cta > span {
  transform: translateX(3px);
  background: var(--colour-accent);
}

/* Stretched link — whole post-it is clickable */
.lp-card__cta::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
}

/* Carousel controls — arrows beneath, with a slide counter */
.latest-posts__controls {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.latest-posts__arrow {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  color: var(--colour-text);
  background: var(--card);
  border: 1px solid rgba(0, 0, 0, 0.16);
  border-radius: 50%;
  box-shadow: 0 2px 6px -3px rgba(0, 0, 0, 0.3);
  transition: opacity 0.2s ease, background 0.2s ease;
}

.latest-posts__arrow::before {
  content: "";
  width: 14px;
  height: 14px;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}

.latest-posts__arrow--prev::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 512'%3E%3Cpath d='M41.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 256 246.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 512'%3E%3Cpath d='M41.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 256 246.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160z'/%3E%3C/svg%3E");
}

.latest-posts__arrow--next::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 512'%3E%3Cpath d='M278.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-160 160c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L210.7 256 73.4 118.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l160 160z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 512'%3E%3Cpath d='M278.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-160 160c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L210.7 256 73.4 118.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l160 160z'/%3E%3C/svg%3E");
}

/* Match the techniques carousel's simple directional glyphs. */
.latest-posts__arrow::before {
  width: auto;
  height: auto;
  background: transparent;
  -webkit-mask-image: none;
  mask-image: none;
  font-size: 1.25rem;
  line-height: 1;
}

.latest-posts__arrow--prev::before { content: "\2190"; }
.latest-posts__arrow--next::before { content: "\2192"; }

.latest-posts__arrow:disabled {
  opacity: 0.3;
  cursor: default;
}

.latest-posts__arrow:not(:disabled):hover {
  background: color-mix(in srgb, var(--card) 88%, var(--colour-accent));
}

.latest-posts__count {
  min-width: 3.5rem;
  font-weight: 700;
  font-size: 0.94rem;
  color: var(--colour-text);
  text-align: center;
}

.latest-posts__foot {
  margin-top: clamp(1.6rem, 3.5vw, 2.4rem);
  text-align: center;
}

@media (max-width: 1200px) {
  .latest-posts__list { --lp-per: 2; }
}

@media (max-width: 640px) {
  .latest-posts__list {
    --lp-per: 1;
    scroll-padding-left: 0;
  }

}
