/* ==========================================================================
   Home (js/views/home.js, js/home-seeds.js). Posts in the wide column; seeds,
   publications and notes stacked in the narrow one. Uses the tokens in
   styles.css and its lead, post row, chip, input, pub-item and engage rules.
   ========================================================================== */

.front {
  max-width: 1280px; /* the header's width, so both columns sit under it */
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 48px;
}
.front__posts, .front__side { min-width: 0; }
.front__side > * + * { margin-top: 40px; }

/* One column: the posts after the first few wait behind a button. */
.front__more { padding-top: 20px; border-top: 1px solid var(--line); }
.front__posts .feed + .feed { border-top: 1px solid var(--line); }

/* --------------------------------------------------------------------------
   Seeds: head, and the filters that open under it
   -------------------------------------------------------------------------- */
.hseeds__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ink);
}
.hseeds__title {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.012em;
}
.hseeds__count {
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
  color: var(--ink-3);
  font-size: var(--fs-sm);
}
.hseeds__count .text-btn { padding-block: 0; }
.hseeds__count .text-btn[aria-expanded="true"] { color: var(--ink); }

.hseeds__browse {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  padding: 12px 0 14px;
  border-bottom: 1px solid var(--line);
}
.hseeds__search, .hseeds__kinds { grid-column: 1 / -1; }
.hseeds__browse .input, .hseeds__browse .select { height: 34px; font-size: var(--fs-sm); }
.hseeds__kinds { display: flex; flex-wrap: wrap; gap: 6px; }

/* --------------------------------------------------------------------------
   Seed rows: smaller than a post row at every level. Publication, headline,
   two lines of thesis, then the facts with the two buttons at the end.
   -------------------------------------------------------------------------- */
.hseed {
  position: relative;
  padding: 14px 0 12px;
  border-bottom: 1px solid var(--line);
}
.hseed .pub-line { gap: 6px; margin-bottom: 3px; font-size: var(--fs-micro); }
.hseed .pub-line__pub { gap: 6px; color: var(--ink-3); font-weight: 500; }
.hseed .pub-logo { --size: 16px; font-size: 7px; }
.hseed__title {
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.005em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.hseed__link { color: var(--ink); text-decoration: none; transition: color 120ms; }
.hseed__link::after { content: ""; position: absolute; inset: 0; z-index: 0; }
.hseed:hover .hseed__link { color: var(--pub-ink); }
.hseed__link:focus-visible { outline: none; }
.hseed:has(.hseed__link:focus-visible) { outline: 2px solid var(--focus); outline-offset: 4px; border-radius: var(--r-sm); }
.hseed__thesis {
  margin-top: 2px;
  max-width: 64ch;
  color: var(--ink-2);
  font-family: var(--serif);
  font-size: 0.875rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* A seed with no headline: the thesis is the title, at reading weight. */
.hseed--bare .hseed__title {
  max-width: 64ch;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-wrap: pretty;
}
.hseed__concepts { margin-top: 4px; color: var(--ink-3); font-size: var(--fs-xs); line-height: 1.4; }
/* The facts wrap inside their own space, so the buttons always end the row at the right. */
.hseed__foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}
.hseed__foot .meta-row { flex: 1 1 auto; gap: 2px 10px; padding-bottom: 6px; }
.hseed__foot .engage { flex: none; flex-wrap: nowrap; }

/* A row that just moved after a vote or an ask: it travels over its neighbours and its
   publication's wash fades out where it lands. */
.hseed--moved { z-index: 2; animation: hseed-land 1100ms var(--ease-out); }
@keyframes hseed-land {
  from { background-color: var(--pub-tint); }
  to { background-color: var(--paper); }
}

.hseed-none {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 24px 0;
}
.hseed-none__title { font-family: var(--serif); font-size: 1rem; font-weight: 600; }

.hseeds__more { margin-top: 16px; }
.hseeds__more:empty { display: none; }

/* --------------------------------------------------------------------------
   Responsive structure
   -------------------------------------------------------------------------- */
@media (pointer: coarse) {
  .hseed .engage__btn { min-height: 36px; padding-inline: 12px; }
  .hseeds__kinds .chip { min-height: 34px; }
  .hseeds__count .text-btn { padding-block: 8px; }
}

@media (max-width: 600px) {
  .front { gap: 32px; }
  .front__side > * + * { margin-top: 32px; }
  .hseeds__browse .input, .hseeds__browse .select { height: 38px; font-size: var(--fs-body); }
  .hseeds__kinds .chip { min-height: 36px; }
}

/* Tablet: one column. At the foot, publications on one side, the event and notes on the other. */
@media (min-width: 640px) and (max-width: 1023px) {
  .front__dir {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto 1fr; /* the short block on top takes only its own height */
    gap: 32px 48px;
    align-items: start;
  }
  .front__dir .side-block + .side-block { margin-top: 0; }
  .front__dir .side-block:first-child { grid-row: span 2; }
}

/* Desktop: two independent stacks with a hairline between them, drawn on the page so it
   runs the full height whichever stack is longer. */
@media (min-width: 1024px) {
  .front {
    --front-gap: clamp(28px, 3vw, 44px);
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 0;
    align-items: start;
    background: linear-gradient(var(--line), var(--line)) 60% 0 / 1px 100% no-repeat content-box;
  }
  .front__posts { padding-right: var(--front-gap); }
  .front__side { padding-left: var(--front-gap); }

  /* The shorter stack scrolls until its last line reaches the bottom of the window, then
     waits there while the longer one runs on. --col-h is each stack's height (home.js). */
  .front__posts, .front__side {
    position: sticky;
    top: min(calc(var(--header-h) + 24px), calc(100dvh - var(--col-h, 100dvh) - 32px));
  }

  /* No seeds in this archive: posts with a sidebar. */
  .front--solo { grid-template-columns: minmax(0, 1fr) 300px; background: none; }
}
