/* ============================================================
   Home Sweet Eclectic: the homepage below the first screen (1.10.0).
   Linked from the body right before #hp-latest (front-page.php), so it never blocks the
   first paint. Latest stories, Editor's picks, the house rules deck, the trust strip and the
   newsletter. The hero, the marquee and the room doors are in home.css.
   Vertical rhythm: no plain-night band taller than 72px (48px on phones) between the hero and
   the footer; every section either owns a colour field or keeps its padding short.
   ============================================================ */

/* Native carousel controls for the picks rail (Chromium 135+); nothing elsewhere */
.picks__rail {
  anchor-name: --picks;
}

/* ---------- 5. Latest stories: a six-card bento ---------- */
.latest {
  padding-block: var(--space-3) var(--space-4);
}
.latest__inner {
  display: grid;
  gap: var(--space-4);
}
.latest__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
}
.latest__title {
  font-size: clamp(2.75rem, 1.8rem + 3.6vw, 5.5rem);
  line-height: 0.9;
}
.latest__title .t-groovy {
  display: inline-block;
  font-size: 0.78em;
  transform: rotate(-4deg);
}
.latest__more {
  margin-left: auto;
}
.latest__cards {
  display: grid;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}
.latest__cards > li {
  min-width: 0;
}
.latest__cards .hse-card {
  --card-ratio: 6 / 5;
}
.latest__cards .hse-card__title {
  font-size: clamp(1.4rem, 1.1rem + 1vw, 2rem);
}
.latest__cards .hse-card--feature .hse-card__title {
  font-size: clamp(1.75rem, 1.2rem + 2vw, 3.25rem);
  line-height: 1.02;
}
.latest__cards .hse-card--feature .hse-card__excerpt {
  max-width: 46ch;
  font-size: var(--text-md);
}
/* Phones: the cards sit a little off-axis from each other, so the column is not a ruler */
@media (max-width: 43.99rem) {
  .latest__cards > li:nth-child(even) > .hse-card {
    margin-left: clamp(0.5rem, 5vw, 1.5rem);
  }
  .latest__cards > li:nth-child(odd):not(:first-child) > .hse-card {
    margin-right: clamp(0.5rem, 5vw, 1.5rem);
  }
}
@media (min-width: 44rem) {
  .latest__cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .latest__cards > li:first-child {
    grid-column: 1 / -1;
  }
}
@media (min-width: 64rem) {
  .latest__cards {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: stretch;
  }
  .latest__cards > li:nth-child(1) { grid-column: 1 / 8; grid-row: 1 / span 2; }
  .latest__cards > li:nth-child(2) { grid-column: 8 / 13; grid-row: 1; }
  .latest__cards > li:nth-child(3) { grid-column: 8 / 13; grid-row: 2; }
  .latest__cards > li:nth-child(4) { grid-column: 1 / 5; grid-row: 3; }
  .latest__cards > li:nth-child(5) { grid-column: 5 / 9; grid-row: 3; padding-top: 2.5rem; }
  .latest__cards > li:nth-child(6) { grid-column: 9 / 13; grid-row: 3; }
  .latest__cards .hse-card--feature {
    --card-ratio: 16 / 10;
  }
  /* The two panels beside the feature: photo window next to the text */
  .latest__cards > li:nth-child(2) .hse-card,
  .latest__cards > li:nth-child(3) .hse-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: var(--space-3);
    align-items: stretch;
  }
  .latest__cards > li:nth-child(2) .hse-card__media,
  .latest__cards > li:nth-child(3) .hse-card__media {
    aspect-ratio: auto;
    min-height: 14rem;
  }
  .latest__cards > li:nth-child(2) .hse-card__body,
  .latest__cards > li:nth-child(3) .hse-card__body {
    padding: var(--space-2) 0.5rem 0.25rem 0;
  }
  /* The last row: tall, square, tall */
  .latest__cards > li:nth-child(4) .hse-card,
  .latest__cards > li:nth-child(6) .hse-card {
    --card-ratio: 4 / 5;
  }
  .latest__cards > li:nth-child(5) .hse-card {
    --card-ratio: 1 / 1;
  }
}

/* ---------- 5b. Editor's picks: a mustard band with a scroll-snap rail ---------- */
.picks {
  position: relative;
  padding-block: calc(var(--space-4) + 0.9rem) var(--space-4);
  background: var(--mustard);
  color: var(--night);
}
.picks::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 0.9rem;
  background: conic-gradient(var(--night) 0 25%, var(--mustard) 0 50%, var(--night) 0 75%, var(--mustard) 0) 0 0 / 1.8rem 1.8rem;
}
.picks__title {
  margin-bottom: var(--space-3);
  font-size: clamp(2.5rem, 1.6rem + 3.4vw, 5rem);
  line-height: 0.92;
}
.picks__title .t-italic {
  color: var(--night);
}
.picks__title .t-groovy {
  display: inline-block;
  color: var(--oxblood);
  font-size: 0.82em;
  rotate: -3deg;
}
.picks__rail {
  --rail-pad: max(var(--gutter), calc((100% - var(--maxw)) / 2));
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(72vw, 17rem);
  gap: var(--space-3);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--rail-pad);
  padding: 1rem var(--rail-pad) 1.25rem;
  scrollbar-color: var(--night) var(--mustard-2);
}
.picks__item {
  min-width: 0;
  scroll-snap-align: start;
}
.hse-card--pick {
  --card-ratio: 4 / 5;
}
.hse-card--pick .hse-card__media {
  border-radius: 999px 999px 1rem 1rem;
}
.hse-card--pick .hse-card__title {
  font-size: var(--text-md);
  line-height: 1.2;
}
.hse-card--pick .hse-card__body {
  gap: 0.5rem;
  padding-top: 0.75rem;
}
.hse-card--pick:hover .hse-card__link {
  text-decoration: underline;
  text-decoration-thickness: 0.12em;
  text-underline-offset: 0.2em;
}
/* The default mustard focus ring would vanish on the mustard band */
.picks .hse-card:has(.hse-card__link:focus-visible) {
  outline-color: var(--night);
}
.picks .hse-card__link:focus-visible {
  outline: none;
}
@supports selector(::scroll-button(left)) and (anchor-name: --a) {
  .picks__rail {
    scroll-marker-group: after;
  }
  .picks__rail::scroll-button(*) {
    position: fixed;
    position-anchor: --picks;
    z-index: 3;
    width: var(--touch);
    height: var(--touch);
    border: 2px solid var(--mustard);
    border-radius: 50%;
    background: var(--night);
    color: var(--mustard);
    font-family: var(--f-ui);
    font-weight: 600;
    cursor: pointer;
  }
  .picks__rail::scroll-button(left) {
    content: "\2190" / "Scroll picks left";
    left: calc(anchor(left) + 0.5rem);
    top: calc(anchor(top) + 8rem);
  }
  .picks__rail::scroll-button(right) {
    content: "\2192" / "Scroll picks right";
    right: calc(anchor(right) + 0.5rem);
    top: calc(anchor(top) + 8rem);
  }
  .picks__rail::scroll-button(*):disabled {
    opacity: 0.35;
    cursor: default;
  }
  .picks__rail::scroll-button(*):focus-visible {
    outline: 3px solid var(--night);
    outline-offset: 2px;
  }
  .picks__rail::scroll-marker-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem;
    padding-top: 0.5rem;
  }
  .picks__item::scroll-marker {
    content: "";
    width: 0.75rem;
    height: 0.75rem;
    padding: 0.4rem;
    border-radius: 50%;
    background: var(--night);
    background-clip: content-box;
    opacity: 0.45;
  }
  .picks__item::scroll-marker:target-current {
    opacity: 1;
  }
}

/* ---------- 6. The house rules: the title over a pattern block, the notes as a deck ---------- */
.rules {
  position: relative;
  margin-top: -14px; /* the wave's valleys show the band above */
  padding-block: calc(var(--space-section) * 0.7) calc(var(--space-section) * 0.8);
  background: var(--aubergine);
  -webkit-mask: var(--wave) 0 0 / 48px 14px repeat-x, linear-gradient(#000 0 0) 0 13px / 100% 100% no-repeat;
  mask: var(--wave) 0 0 / 48px 14px repeat-x, linear-gradient(#000 0 0) 0 13px / 100% 100% no-repeat;
}
.rules::before {
  content: "";
  position: absolute;
  top: 14px;
  bottom: 0;
  right: 0;
  width: clamp(1.5rem, 4vw, 3.5rem);
  background: repeating-linear-gradient(180deg, var(--emerald) 0 22px, transparent 0 44px);
}
.rules__inner {
  position: relative;
  display: grid;
  gap: var(--space-4);
}
.rules__lede {
  position: relative;
}
.rules__title {
  position: relative;
  z-index: 1;
  font-size: clamp(3rem, 1.8rem + 5vw, 7.5rem);
  line-height: 0.92;
}
.rules__title .t-italic,
.rules__title .t-groovy {
  display: block;
}
.rules__block {
  display: block;
  width: min(100%, 26rem);
  height: clamp(8rem, 6rem + 8vw, 16rem);
  margin-top: calc(var(--space-3) + 0.75rem); /* clear of the title box, rotation slop included (1.10.0 F2) */
  border-radius: 999px 999px var(--radius-lg) var(--radius-lg);
  background: conic-gradient(var(--mustard) 0 25%, var(--oxblood) 0 50%, var(--mustard) 0 75%, var(--oxblood) 0) 0 0 / 2.5rem 2.5rem;
  rotate: -3deg;
}
.rules__list {
  display: grid;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}
.rules__item {
  position: relative;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--ri-bg);
  color: var(--ri-ink);
  box-shadow: 0 1.4rem 2.4rem -1.2rem rgba(0, 0, 0, 0.75);
  transform-origin: 50% 0;
}
.rules__item p {
  margin: 0;
  font-family: var(--f-head);
  font-size: clamp(1.4rem, 1.05rem + 1.3vw, 2.35rem);
  line-height: 1.15;
  text-wrap: balance;
}
.rules__item--cobalt { --ri-bg: var(--cobalt); --ri-ink: var(--cream); rotate: -1.5deg; }
.rules__item--mustard { --ri-bg: var(--mustard); --ri-ink: var(--night); rotate: 1.2deg; }
.rules__item--emerald { --ri-bg: var(--emerald); --ri-ink: var(--cream); rotate: -0.8deg; }
.rules__sticker {
  position: absolute;
  right: 4%;
  top: 0.25rem;
  z-index: 2;
  --tilt: 7deg;
}
@media (min-width: 64rem) {
  .rules__inner {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: center;
  }
  .rules__list {
    padding-right: clamp(1.5rem, 4vw, 3.5rem);
  }
  .rules__item--mustard {
    margin-left: 12%;
    margin-right: 2%;
  }
  .rules__item--cobalt {
    margin-right: 10%;
  }
  .rules__item--emerald {
    margin-left: 4%;
  }
  .rules__sticker {
    top: auto;
    right: auto;
    left: 22%;
    bottom: 8%;
  }
}
@media (min-width: 40.01rem) and (max-width: 63.99rem) {
  .rules__sticker {
    display: none;
  }
}
@media (max-width: 40rem) {
  .rules__list {
    padding-inline: 0.85rem;
  }
  .rules__sticker {
    position: static;
    margin-top: var(--space-3);
  }
}

/* The deck. Where the browser has scroll-driven animations and motion is welcome, each note is
   sticky a step lower than the one before and sinks (scale, dimmed by an overlay's opacity)
   while the next one rises over it. A stuck element's own view() progress stops advancing, so
   each note is driven by the NEXT note's named view timeline (timeline-scope on the list).
   Without support, or under reduced motion, the notes are the plain stack above. */
@keyframes hse-sink {
  to { scale: 0.92; }
}
@keyframes hse-dim {
  to { opacity: 0.5; }
}
@supports (animation-timeline: view()) and (timeline-scope: --deck1) {
  @media (prefers-reduced-motion: no-preference) {
    .rules__list {
      timeline-scope: --deck1, --deck2;
      padding-bottom: 3rem;
    }
    .rules__item {
      position: sticky;
      top: calc(var(--header-h) + 1rem + var(--i, 0) * 1.1rem);
    }
    .rules__item::after {
      content: "";
      position: absolute;
      inset: 0;
      border-radius: inherit;
      background: var(--night);
      opacity: 0;
      pointer-events: none;
    }
    .rules__item:nth-child(2) { view-timeline: --deck1 block; }
    .rules__item:nth-child(3) { view-timeline: --deck2 block; }
    .rules__item:nth-child(1) {
      animation: hse-sink linear both;
      animation-timeline: --deck1;
      animation-range: cover 20% cover 55%;
    }
    .rules__item:nth-child(1)::after {
      animation: hse-dim linear both;
      animation-timeline: --deck1;
      animation-range: cover 20% cover 55%;
    }
    .rules__item:nth-child(2) {
      animation: hse-sink linear both;
      animation-timeline: --deck2;
      animation-range: cover 20% cover 55%;
    }
    .rules__item:nth-child(2)::after {
      animation: hse-dim linear both;
      animation-timeline: --deck2;
      animation-range: cover 20% cover 55%;
    }
  }
}

/* ---------- 6b. Trust strip ---------- */
.trust {
  position: relative;
  padding-block: calc(var(--space-3) + 0.6rem) calc(var(--space-3) + var(--space-4));
  background: var(--cream);
  color: var(--night);
}
.trust::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 0.6rem;
  background: repeating-linear-gradient(90deg, var(--oxblood) 0 1rem, var(--mustard) 0 2rem);
}
.trust__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
}
.trust__line {
  margin: 0;
  font-size: var(--text-xl);
  line-height: 1.1;
  text-wrap: balance;
}
.trust__line .t-italic {
  color: var(--night);
}
.trust__name {
  font-family: var(--f-groovy);
  font-weight: 400;
  color: var(--fuchsia);
}
.pill--night {
  --pill-bg: var(--night);
  --pill-ink: var(--cream);
  --pill-line: var(--night);
  --pill-bg-hover: var(--plum);
}
.trust a:focus-visible {
  outline-color: var(--oxblood);
}

/* ---------- 7. Newsletter ---------- */
.news {
  --r: 20px;
  position: relative;
  margin-top: calc(-1 * var(--space-4));
  padding-block: calc(var(--space-4) + var(--r)) var(--space-5);
  background: var(--cobalt);
  -webkit-mask: radial-gradient(var(--r) at 50% var(--r), #000 calc(100% - 1px), #0000) 50% 0 / calc(2 * var(--r)) calc(2 * var(--r)) repeat-x, linear-gradient(#000 0 0) 0 var(--r) / 100% 100% no-repeat;
  mask: radial-gradient(var(--r) at 50% var(--r), #000 calc(100% - 1px), #0000) 50% 0 / calc(2 * var(--r)) calc(2 * var(--r)) repeat-x, linear-gradient(#000 0 0) 0 var(--r) / 100% 100% no-repeat;
}
.news__inner {
  position: relative;
  display: grid;
  gap: var(--space-4);
  align-items: center;
}
.news__title {
  max-width: 16ch;
  font-size: clamp(2.25rem, 1.5rem + 3.2vw, 4.5rem);
  line-height: 1;
}
.news__title .t-groovy {
  color: var(--mustard-2);
}
.news__sub {
  max-width: 40ch;
  margin: var(--space-2) 0 0;
  color: var(--cream);
  font-family: var(--f-read);
  font-size: var(--text-md);
}
.news__form {
  padding: var(--space-3);
  border: 2px solid var(--cream);
  border-radius: var(--radius-lg);
  background: var(--night-2);
  box-shadow: 0.6rem 0.6rem 0 var(--mustard);
}
.news__label {
  display: block;
  width: fit-content;
  margin-bottom: 0.5rem;
  color: var(--cream);
  font-weight: 600;
  font-size: var(--text-sm);
}
.news__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.news__input {
  flex: 1 1 14rem;
  min-width: 0;
  min-height: 3.25rem;
  padding: 0 1.3rem;
  border: 2px solid var(--cream);
  border-radius: 999px;
  background: var(--night);
  color: var(--cream);
  font-family: var(--f-ui);
  font-size: var(--text-md);
}
.news__input::placeholder {
  color: var(--line-strong);
  opacity: 1;
}
.news__input:focus-visible {
  outline: 3px solid var(--mustard);
  outline-offset: 2px;
}
.news__button {
  min-height: 3.25rem;
  padding-inline: 1.8rem;
  border-color: var(--night);
  font-size: var(--text-base);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.news__button:disabled {
  opacity: 0.6;
  cursor: progress;
}
.news__note {
  min-height: 1.6em;
  margin: 0.75rem 0 0;
  color: var(--cream);
  font-size: var(--text-sm);
}
.news__sticker {
  /* In the flow on one-column layouts, above the copy and never over it (1.10.0 F1) */
  order: -1;
  justify-self: end;
  margin: calc(-1 * var(--space-2)) 2% 0 0;
  --tilt: 9deg;
}
@media (min-width: 56rem) {
  .news__inner {
    grid-template-columns: 1.1fr 1fr;
    align-items: start;
  }
}
@media (min-width: 70rem) {
  .news__sticker {
    position: absolute;
    top: calc(-1 * var(--space-3));
    right: 2%;
    order: 0;
    margin: 0;
  }
}

/* ---------- Motion: reveals as the sections enter (compositor properties only) ---------- */
@keyframes hse-rise {
  from {
    translate: 0 3rem;
  }
}
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .rules__sticker,
    .news__sticker {
      animation: hse-wobble-in linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 30%;
    }
    .latest__cards > li {
      animation: hse-rise linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 25%;
    }
  }
}
