@layer components {
/* One grid for the whole page: the query spans it, the facets form a rail on
   the left and the results fill the right, so a filter never pushes the
   results off screen. The form and fieldset are display: contents so their
   children sit in the grid directly. */
/* At least a viewport tall, so the footer stays below the fold while results load and nothing visible shifts. */
.discovery-page { min-height: 100svh; display: grid; grid-template-columns: 17rem minmax(0, 1fr); grid-template-areas: "head head" "query query" "facets toolbar" "facets reset" "facets failure" "facets results" "fallback fallback"; column-gap: clamp(2rem, 4vw, 4rem); align-content: start; padding-block: clamp(2rem, 5vw, 5rem); }
.discovery-heading { grid-area: head; }
.discovery-heading h1 { max-width: 16ch; font-size: var(--h1); margin-block: 1rem 1.5rem; }
.discovery-heading .dek { max-width: 60ch; }
search, #archive-search, #search-controls { display: contents; }
.discovery-query { grid-area: query; border-top: 1px solid var(--rule); margin-top: 2rem; padding-block: 1.5rem; }
/* The query field: one wide line with the search icon inside it. */
.discovery-query-field { display: flex; gap: .75rem; align-items: center; }
.discovery-query-input { position: relative; flex: 1; min-width: 0; display: flex; }
.discovery-query-input .icon { position: absolute; left: 1rem; top: 50%; translate: 0 -50%; width: 1.25rem; height: 1.25rem; color: var(--ink-2); pointer-events: none; }
.discovery-query input { flex: 1; min-width: 0; min-height: 56px; padding: .75rem 1rem .75rem 3rem; font-size: var(--lede); }
.discovery-query input::placeholder { color: var(--ink-2); opacity: .8; }
.discovery-query input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.discovery-help { color: var(--ink-2); font-size: .8rem; margin-block: .6rem 0; max-width: 80ch; }
.discovery-help kbd { font: inherit; border: 1px solid var(--rule); border-radius: .3rem; padding: 0 .35em; }
/* Facets: the rail. Each group is a label and its chips; counts say how many posts a chip would leave. */
.discovery-facets { grid-area: facets; align-self: start; position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow-y: auto; scrollbar-width: thin; display: grid; gap: 1rem; border-top: 1px solid var(--rule); padding-top: 1rem; }
.discovery-facets:empty { display: none; }
.facet-group { display: grid; gap: .5rem; }
.facet-label { font-size: .72rem; font-weight: 500; color: var(--ink-2); }
.facet-group .chips { gap: .35rem; }
.chip { display: inline-flex; align-items: center; gap: .5rem; min-height: 36px; padding: .25rem .75rem; border: 1px solid var(--rule); border-radius: 8px; background: var(--ground-2); font-size: .82rem; line-height: 1.2; }
.chip .count { font-size: .7rem; }
.chip[aria-pressed=true] { background: var(--ink); color: var(--ground); border-color: var(--ink); }
.chip[aria-pressed=true] .count { color: inherit; opacity: .7; }
.chip:disabled { opacity: .4; cursor: default; }
.chip:disabled:hover { border-color: var(--rule); color: inherit; }
.chip-more { background: none; border-style: dashed; color: var(--ink-2); }
/* Status on the left, the view switch on the right. */
.discovery-toolbar { grid-area: toolbar; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem 1.5rem; border-top: 1px solid var(--rule); padding-block: .75rem; }
#search-status { min-height: 1.5rem; color: var(--ink-2); font-size: .9rem; }
.view-switch { display: inline-flex; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.view-switch button { min-height: 40px; padding: .35rem .9rem; border: 0; border-radius: 0; background: none; font-size: .85rem; display: inline-flex; align-items: center; gap: .4rem; }
.view-switch button[aria-pressed=true] { background: var(--ink); color: var(--ground); }
.view-switch .icon { width: 1rem; height: 1rem; }
#search-reset { grid-area: reset; justify-self: start; font-size: .85rem; min-height: 40px; display: inline-flex; align-items: center; }
#search-failure { grid-area: failure; }
#search-results-region { grid-area: results; min-width: 0; }
#search-fallback { grid-area: fallback; }
#search-failure, #search-empty { padding: 1.5rem; border: 1px solid var(--rule); margin-block: 1rem; }
#search-failure button { margin-top: 1rem; }
#search-empty h2 { font-size: 2rem; margin-bottom: 1rem; }
/* Results. Photos: the site's cards. List: one line each, newest first. */
.discovery-results[data-view=visual] .discovery-result .card-title { font-size: var(--lede); }
.discovery-results[data-view=visual] .discovery-snippet { color: var(--ink-2); font-size: .9rem; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.discovery-results[data-view=list] { display: grid; gap: 0; }
.discovery-results[data-view=list] .discovery-result { display: grid; grid-template-columns: minmax(0, 1fr); gap: .35rem; border-top: 1px solid var(--rule); padding-block: 1.25rem; min-width: 0; overflow-wrap: anywhere; }
.discovery-results[data-view=list] h2 { font-size: var(--h2); line-height: 1.1; max-width: 30ch; }
.discovery-results[data-view=list] h2 a { text-decoration: none; }
.discovery-results[data-view=list] h2 a:hover { color: var(--signal); }
.discovery-results[data-view=list] .discovery-snippet { max-width: 70ch; color: var(--ink-2); font-size: .95rem; }
.discovery-result-topics { position: relative; z-index: 2; display: flex; flex-wrap: wrap; gap: .1rem .5rem; font-size: .78rem; margin-top: .15rem; }
.discovery-result-topics a { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; min-height: 24px; padding-inline: .15rem; color: var(--ink-2); text-decoration-color: transparent; }
.discovery-result-topics a:hover { color: var(--signal); text-decoration-color: currentColor; }
mark { background: color-mix(in srgb, var(--signal) 22%, transparent); color: var(--ink); border-radius: 2px; padding-inline: .05em; box-decoration-break: clone; }
.discovery-pagination { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-block: 2rem; }
.discovery-pagination a { display: inline-flex; align-items: center; justify-content: center; padding: .5rem .75rem; min-width: 44px; min-height: 44px; border: 1px solid var(--rule); border-radius: 8px; text-decoration: none; }
.discovery-pagination [aria-current=page] { background: var(--ink); color: var(--ground); }
#search-fallback h2 { font-size: 2rem; margin-block: 1rem; }
.discovery-browse { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; padding-block: 1.5rem; }
.discovery-browse a { display: inline-flex; align-items: center; min-height: 44px; }
.discovery-static-list { list-style: none; padding: 0; margin-block: 1rem; }
.discovery-static-list li { display: grid; grid-template-columns: 7rem minmax(0, 1fr); align-items: baseline; gap: 1rem; border-bottom: 1px solid var(--rule); }
.discovery-static-list time { font-size: .85rem; color: var(--ink-2); }
.discovery-static-list a { padding-block: .7rem; overflow-wrap: anywhere; }
/* /archives/: the almanac, a sticky bar of years and the filter, then every
   title under its year and month. The month label sticks in a left gutter
   beside its posts; the next month pushes it out. */
.archive { padding-block: clamp(2rem, 5vw, 5rem); --tools: 4.25rem; }
.archive-head { margin-bottom: var(--s6); }
.archive-head .page-head-meta a { min-height: 2rem; display: inline-flex; align-items: center; }
.archive-almanac { padding: var(--s4); }
.archive-almanac h2 { font-size: var(--small); font-weight: 500; }
.archive-almanac .plate-head > span { color: var(--ink-2); }
.almanac-scroll { overflow-x: auto; scrollbar-width: thin; }
.almanac { width: 100%; min-width: 34rem; border-collapse: separate; border-spacing: 3px; table-layout: fixed; font-size: var(--tiny); font-variant-numeric: tabular-nums; }
.almanac th, .almanac td { border: 0; vertical-align: middle; }
.almanac th { font-weight: 500; color: var(--ink-2); text-align: center; padding: 0 0 .2rem; }
.almanac abbr { text-decoration: none; }
.almanac thead th:first-child, .almanac tbody th { width: 3.25rem; text-align: left; }
.almanac thead th:last-child, .almanac-total { width: 3.5rem; text-align: right; color: var(--ink-2); padding-right: .25rem; }
.almanac tbody th a { color: var(--ink); text-decoration: none; font-weight: 600; }
.almanac tbody th a:hover { color: var(--signal); }
.almanac td { height: 2.25rem; padding: 0; text-align: center; border-radius: 4px; }
/* The darkest tint is capped per scheme so the count stays legible in ink on every cell. */
.almanac { --tint: light-dark(color-mix(in srgb, var(--signal) 55%, var(--ground)), color-mix(in srgb, var(--signal) 40%, var(--ground))); }
.almanac td:not(.empty, .almanac-total) { background: color-mix(in srgb, var(--tint) calc(15% + var(--n) * .85%), var(--ground)); }
.almanac td a { display: grid; place-items: center; height: 100%; border-radius: inherit; text-decoration: none; color: var(--ink); font-weight: 500; }
.almanac td a:hover { outline: 2px solid var(--ink); outline-offset: -2px; }
.almanac td.empty { color: var(--rule-strong); background: var(--ground-3); opacity: .5; }
.archive-tools { position: sticky; top: 0; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s5); margin-top: var(--s6); padding-block: var(--s3); background: var(--ground); border-bottom: 1px solid var(--ink); }
.archive-years { display: flex; flex-wrap: wrap; gap: var(--s1); }
.archive-years a { display: inline-grid; place-items: center; min-height: 2.5rem; padding-inline: .75rem; border: 1px solid var(--rule); border-radius: 8px; font-size: var(--small); font-weight: 500; font-variant-numeric: tabular-nums; color: var(--ink); text-decoration: none; }
.archive-years a:hover { border-color: var(--ink); }
.archive-years a[aria-current] { background: var(--ink); color: var(--ground); border-color: var(--ink); }
.archive-filter { display: flex; align-items: center; gap: var(--s3); flex: 1 1 18rem; max-width: 30rem; }
.archive-filter[hidden] { display: none; }
.archive-filter input { flex: 1; min-width: 0; min-height: 2.5rem; padding: .5rem .75rem; border-radius: 8px; }
.archive-filter p { margin: 0; font-size: var(--tiny); color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.archive-filter p:empty { display: none; }
.archive-year { scroll-margin-top: var(--tools); }
.archive-year > h2 { display: flex; align-items: baseline; gap: var(--s3); font-size: var(--figure); letter-spacing: -.02em; margin: var(--s7) 0 0; padding-bottom: var(--s3); border-bottom: 1px solid var(--rule-strong); }
.archive-count { color: var(--ink-2); font-size: var(--tiny); font-weight: 400; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.archive-month { display: grid; grid-template-columns: 9rem minmax(0, 1fr); column-gap: var(--s5); border-bottom: 1px solid var(--rule); scroll-margin-top: var(--tools); }
.archive-month-label { position: sticky; top: calc(var(--tools) + var(--s3)); align-self: start; display: flex; align-items: baseline; gap: var(--s2); margin: 0; padding-block: var(--s3); font-size: var(--text); font-weight: 600; }
.archive-month-label a { color: var(--ink); text-decoration: none; }
.archive-month-label a:hover { color: var(--signal); }
.archive-month:target .archive-month-label a { color: var(--signal); }
.archive-rows { list-style: none; padding: 0; margin: 0; }
.archive-rows li { display: grid; grid-template-columns: 3.75rem minmax(0, 1fr) auto; align-items: baseline; gap: var(--s4); padding-block: .55rem; border-top: 1px solid var(--rule); }
.archive-rows li:first-child { border-top: 0; }
.archive-rows time, .archive-kicker { font-size: var(--tiny); color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.archive-rows a { color: var(--ink); text-decoration: none; text-wrap: pretty; overflow-wrap: anywhere; }
.archive-rows a:hover { color: var(--signal); text-decoration: underline; }
.archive-empty { padding: var(--s5); margin-top: var(--s5); border: 1px solid var(--rule); border-radius: var(--radius); }
/* 404: the head, then what notfound.js found in the address (close matches as rows, named terms as chips), then the search box prefilled from it. */
.notfound { max-width: 60rem; padding-block: clamp(2rem, 5vw, 5rem) 0; }
.notfound .page-head { margin-bottom: 0; }
.notfound-path { font-size: .75em; overflow-wrap: anywhere; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.notfound-block { display: block; margin-top: var(--s7); }
.notfound-block h2 { font-size: var(--text); font-weight: 600; margin-bottom: var(--s3); }
.notfound .discovery-query { margin-top: 0; }
.notfound-label { display: block; font-weight: 600; margin-bottom: var(--s3); }
.notfound .rows > li { display: flow-root; padding-block: var(--s3); }
.notfound .rows-head { flex-direction: column; align-items: flex-start; gap: var(--s1); margin-bottom: 0; }
.notfound .rows-thumb { width: 5rem; margin: 0 0 0 var(--s4); }
.notfound .rows-meta span { white-space: nowrap; }
.notfound .chips a { display: inline-flex; align-items: center; gap: .35em; }
.notfound .chips .icon { width: 1em; height: 1em; color: var(--ink-2); }
.notfound .chips .count { color: var(--ink-2); }
.notfound .browse-line { margin-top: var(--s6); }
}
@layer responsive {
@media (max-width: 1000px) {
  /* One column: the facets become scrolling rows between the query and the results. */
  .discovery-page { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "query" "facets" "toolbar" "reset" "failure" "results" "fallback"; }
  .discovery-facets { position: static; max-height: none; overflow: visible; gap: 0; }
  .facet-group { grid-template-columns: 6rem minmax(0, 1fr); align-items: center; gap: .5rem; padding-block: .4rem; border-bottom: 1px solid var(--rule); }
  .facet-group .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-block: .2rem; scroll-snap-type: x proximity; mask-image: linear-gradient(90deg, #000 calc(100% - 2.5rem), transparent); }
  .facet-group .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; scroll-snap-align: start; white-space: nowrap; }
}
@media (max-width: 600px) {
  .facet-group { grid-template-columns: minmax(0, 1fr); gap: .2rem; }
  .discovery-static-list li { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: .65rem; }
  /* The bar of years and the filter scroll away; the month label becomes a sticky bar of its own above its posts. */
  .archive { --tools: 0rem; }
  /* Twelve months fit a 360px phone with every month still a 24px target. */
  .archive-almanac { padding: 0; border: 0; background: none; border-radius: 0; }
  .almanac { min-width: 0; border-spacing: 1px; font-size: .68rem; }
  .almanac thead th:first-child, .almanac tbody th { width: 2.2rem; }
  .almanac thead th:last-child, .almanac-total { display: none; }
  .almanac td { height: 1.9rem; }
  .almanac thead abbr { font-size: 0; }
  .almanac thead abbr::after { content: attr(data-short); font-size: .68rem; }
  .archive-tools { position: static; }
  .archive-years { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .archive-filter { flex-basis: 100%; max-width: none; }
  .archive-month { grid-template-columns: minmax(0, 1fr); }
  .archive-month-label { top: 0; z-index: 2; background: var(--ground); border-bottom: 1px solid var(--rule); }
  .archive-rows li { grid-template-columns: 3.25rem minmax(0, 1fr); gap: 0 var(--s3); }
  .archive-kicker { grid-column: 2; }
}
}
