/* /posts: a categorized, searchable index. Centered hero with search,
   sticky topic chips, three "start here" features, then one quiet list per
   topic. Loaded after editorial.css and brand.css, before palette.css. */

.posts-page { --posts-top: 96px; }

/* --- Hero + search -------------------------------------------------------- */
.posts-hero { padding-bottom: 34px; text-align: center; }
.posts-hero h1 { max-width: 14ch; }
.posts-hero .article-deck { max-width: 46ch; }

.posts-search {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 620px;
  margin: 30px auto 0;
}
.posts-search input {
  width: 100%;
  height: 58px;
  padding: 0 56px 0 54px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font: 400 17px/1 var(--font);
  box-shadow: 0 1px 0 rgb(18 63 74 / 0.03), 0 14px 30px -26px rgb(18 63 74 / 0.45);
  transition: border-color 160ms, box-shadow 160ms;
  -webkit-appearance: none;
  appearance: none;
}
.posts-search input::placeholder { color: #9a9d9c; }
.posts-search input:focus {
  outline: none;
  border-color: var(--action);
  box-shadow: 0 0 0 4px rgb(91 157 185 / 0.16), 0 14px 30px -26px rgb(18 63 74 / 0.45);
}
.posts-search input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.posts-search-icon {
  position: absolute;
  left: 21px;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--forest);
  stroke-width: 1.8;
  stroke-linecap: round;
  pointer-events: none;
}
.posts-search-key {
  position: absolute;
  right: 20px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font: 500 12px/1 var(--mono);
  pointer-events: none;
  transition: opacity 120ms;
}
.posts-search input:focus ~ .posts-search-key,
.posts-search.has-value .posts-search-key { opacity: 0; }

/* --- Topic chips (sticky under the header) -------------------------------- */
.posts-topics {
  position: sticky;
  top: var(--posts-top);
  z-index: 21; /* above the header so its cream wave edge never clips the chips */
  background: rgb(250 247 239 / 0.92);
  -webkit-backdrop-filter: saturate(1.2) blur(12px);
  backdrop-filter: saturate(1.2) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 200ms;
}
/* An open mobile menu drops down from the header, so it must sit on top. */
body:has(.menu-button[aria-expanded="true"]) .posts-topics { z-index: 10; }
.posts-topics.is-stuck { border-bottom-color: var(--line); }
.posts-topics-in {
  display: flex;
  gap: 6px;
  max-width: 1360px;
  margin: 0 auto;
  padding: 12px var(--gutter, 24px);
  flex-wrap: wrap;
  justify-content: center;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.posts-topics-in::-webkit-scrollbar { display: none; }
.posts-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.6);
  color: var(--text);
  font: 500 14px/1 var(--font);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 160ms, border-color 160ms, color 160ms;
}
.posts-chip span { color: var(--muted); font: 500 11px/1 var(--mono); transition: color 160ms; }
.posts-chip:hover { border-color: var(--action); }
.posts-chip:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }
.posts-chip[aria-pressed="true"] { background: var(--action); border-color: var(--action); color: #fff; }
.posts-chip[aria-pressed="true"] span { color: rgb(255 255 255 / 0.78); }

/* --- Start here ----------------------------------------------------------- */
.posts-hub .wrap { padding-top: 40px; }
.posts-kicker {
  margin: 0 0 18px;
  color: var(--muted);
  font: 500 11px/1.4 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.posts-start { padding-bottom: 56px; }
.posts-start-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
.posts-feature { display: block; color: inherit; text-decoration: none; }
.posts-feature-img {
  display: block;
  aspect-ratio: 4 / 3;
  margin-bottom: 18px;
  border-radius: 16px;
  background: var(--sage-light);
  overflow: hidden;
}
.posts-feature-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 600ms var(--groove-ease, ease);
}
.posts-feature:hover .posts-feature-img img { transform: scale(1.035); }
.posts-feature-meta { color: var(--muted); font: 500 11px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.posts-feature h3 {
  margin: 8px 0 8px;
  color: var(--heading);
  font: var(--display-weight, 500) clamp(23px, 2vw, 27px)/1.12 var(--display);
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.posts-feature:hover h3 { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }
.posts-feature p { color: var(--muted); font-size: 15.5px; line-height: 1.55; text-wrap: pretty; }

/* --- Topic sections ------------------------------------------------------- */
.posts-status { margin: 0; color: var(--muted); font: 500 12px/1.4 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; }
.posts-status:empty { display: none; }
.posts-status:not(:empty) { padding-bottom: 18px; }

.posts-topic {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 24px clamp(32px, 5vw, 80px);
  padding: 44px 0 48px;
  border-top: 1px solid var(--line);
  scroll-margin-top: calc(var(--posts-top) + 76px);
}
.posts-topic-head { align-self: start; position: sticky; top: calc(var(--posts-top) + 88px); }
.posts-topic-num { display: block; margin-bottom: 14px; color: var(--muted); font: 500 11px/1 var(--mono); letter-spacing: 0.1em; }
.posts-topic-head h2 {
  margin: 0 0 10px;
  color: var(--heading);
  font: var(--display-weight, 500) clamp(30px, 2.8vw, 38px)/1.04 var(--display);
  letter-spacing: -0.035em;
}
.posts-topic-head p { max-width: 28ch; color: var(--muted); font-size: 15px; line-height: 1.55; }

.posts-list { margin: 0; padding: 0; list-style: none; }
.posts-list li:not([hidden]) ~ li { border-top: 1px solid var(--line); }
.posts-list li[hidden] { display: none; }
.posts-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 24px;
  margin: 0 -16px;
  padding: 18px 16px;
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
  transition: background-color 160ms;
}
.posts-row:hover { background: rgb(255 255 255 / 0.75); }
.posts-row:focus-visible { outline: 2px solid var(--action); outline-offset: -2px; }
.posts-row-copy { display: grid; gap: 5px; min-width: 0; }
.posts-row strong {
  color: var(--heading);
  font: var(--display-weight, 500) 20px/1.25 var(--display);
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.posts-row-copy > span {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.posts-row-time {
  color: var(--muted);
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.posts-row-time::after {
  content: "→";
  display: inline-block;
  width: 0;
  margin-left: 0;
  opacity: 0;
  color: var(--forest);
  font: 400 14px/1 var(--font);
  transition: opacity 160ms, width 160ms, margin 160ms;
}
.posts-row:hover .posts-row-time::after { width: 14px; margin-left: 8px; opacity: 1; }
.posts-list mark { padding: 0 1px; border-radius: 3px; background: rgb(234 220 198 / 0.9); color: inherit; }

/* Filtered views: no sticky headers needed, the list is short. */
.posts-hub.is-filtered .posts-start { display: none; }
.posts-topic[hidden], .posts-empty[hidden] { display: none; }
.posts-hub.is-filtered .posts-topic.is-first { border-top: 0; padding-top: 8px; }

.posts-hub.is-searching .posts-topic { padding: 22px 0 18px; row-gap: 6px; }
.posts-hub.is-searching .posts-topic.is-first { padding-top: 4px; }
.posts-hub.is-searching .posts-topic-head { position: static; padding-top: 18px; }
.posts-hub.is-searching .posts-topic-num,
.posts-hub.is-searching .posts-topic-head p { display: none; }
.posts-hub.is-searching .posts-topic-head h2 { font-size: 22px; }

.posts-empty { padding: 48px 0 64px; border-top: 1px solid var(--line); text-align: center; color: var(--text); font-size: 17px; line-height: 1.6; }
.posts-empty p + p { margin-top: 6px; color: var(--muted); font-size: 15px; }
.posts-empty a, .posts-empty button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

.posts-hub .journal-cta { margin-top: 24px; }

/* --- Tablet ---------------------------------------------------------------- */
@media (max-width: 1100px) {
  .posts-page { --posts-top: 80px; }
  .posts-topics-in { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; }
}
@media (max-width: 900px) {
  .posts-start-grid { gap: 20px; }
  .posts-topic { grid-template-columns: minmax(0, 1fr); gap: 18px; padding: 36px 0 32px; }
  .posts-topic-head { position: static; }
  .posts-topic-head p { max-width: 46ch; }
  .posts-topic-num { margin-bottom: 10px; }
}

/* --- Phone ----------------------------------------------------------------- */
@media (max-width: 760px) {
  .posts-hero { padding-bottom: 22px; }
  .posts-hero .article-deck { margin-top: 14px; font-size: 16px; }
  .posts-search { margin-top: 22px; }
  .posts-search input { height: 52px; padding-left: 48px; padding-right: 20px; font-size: 16px; }
  .posts-search-icon { left: 18px; }
  .posts-search-key { display: none; }

  .posts-topics-in { padding: 10px 16px; gap: 6px; }
  .posts-chip { min-height: 38px; padding: 0 14px; font-size: 13.5px; }

  .posts-hub .wrap { padding-top: 28px; }
  .posts-start { padding-bottom: 36px; }
  .posts-start-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .posts-feature {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    grid-template-rows: auto auto 1fr;
    column-gap: 16px;
    padding: 14px 0;
  }
  .posts-feature + .posts-feature { border-top: 1px solid var(--line); }
  .posts-feature-img { grid-row: 1 / 4; aspect-ratio: 1; margin: 0; border-radius: 12px; }
  .posts-feature h3 { margin: 4px 0 4px; font-size: 20px; }
  .posts-feature p { font-size: 14.5px; line-height: 1.45; }

  .posts-topic { padding: 30px 0 24px; gap: 10px; }
  .posts-topic-head h2 { font-size: 30px; }
  .posts-topic-head p { font-size: 14.5px; }
  .posts-row { gap: 14px; margin: 0 -10px; padding: 15px 10px; }
  .posts-row strong { font-size: 18.5px; }
  .posts-row-copy > span { font-size: 14.5px; }
  .posts-row-time::after { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .posts-feature-img img, .posts-row, .posts-chip, .posts-row-time::after { transition: none; }
  .posts-feature:hover .posts-feature-img img { transform: none; }
}
