/* Site styles on top of Pico (pico-2.1.1.min.css): list of ads, filters, details panel. Colours come from Pico's
   variables, so light and dark mode follow the system setting. */

:root { --gap: .75rem; }
body { min-height: 100vh; }
.muted { color: var(--pico-muted-color); }
main.container { padding-top: 1rem; }

/* top bar */
.topbar { border-bottom: 1px solid var(--pico-muted-border-color); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: .5rem 1rem; flex-wrap: wrap;
                padding-block: .6rem; }
.brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.15rem;
         color: var(--pico-color); text-decoration: none; }
.toplinks { display: flex; gap: 1rem; font-size: .95rem; }
.toplinks a { text-decoration: none; }

/* filter bar */
.filters-bar { display: flex; flex-direction: column; gap: var(--gap); margin-bottom: 1rem; }
.search { margin: 0; }
.search input[type=search] { margin: 0; }
.ad .excerpt .loc { font-weight: 600; color: var(--pico-color); }
.panel-loc { font-weight: 600; margin: .2rem 0; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--pico-muted-border-color);
       border-radius: var(--pico-border-radius); overflow: hidden; align-self: flex-start; }
.seg a { padding: .4rem .9rem; text-decoration: none; color: var(--pico-color); }
.seg a + a { border-left: 1px solid var(--pico-muted-border-color); }
.seg a[aria-current] { background: var(--pico-primary-background); color: var(--pico-primary-inverse); }

.filters-bar button { width: auto; margin: 0; padding: .35rem .8rem; font-size: .95rem; }
.filter-buttons { display: flex; flex-wrap: wrap; gap: .5rem; }
.filter-buttons button.chosen { border-color: var(--pico-primary); color: var(--pico-primary); }
.filter-buttons button.open { background: var(--pico-primary-background); color: var(--pico-primary-inverse); }
.filters-toggle { align-self: flex-start; }
.filters { display: none; flex-direction: column; gap: var(--gap); }
.filters.open { display: flex; }

.picker { display: flex; flex-wrap: wrap; gap: .4rem; padding: .6rem; border-radius: var(--pico-border-radius);
          background: var(--pico-card-sectioning-background-color); }
.picker a, .period-links a, .chip {
  display: inline-block; padding: .2rem .65rem; border-radius: 999px; font-size: .9rem; text-decoration: none;
  border: 1px solid var(--pico-muted-border-color); color: var(--pico-color); background: var(--pico-background-color); }
.picker a:hover, .period-links a:hover, .chip:hover { border-color: var(--pico-primary); }
.picker a[aria-current], .period-links a[aria-current] {
  background: var(--pico-primary-background); color: var(--pico-primary-inverse); border-color: transparent; }

.chips { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.chip { border-color: var(--pico-primary); }
.reset { font-size: .9rem; margin-left: .3rem; }

.period { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; font-size: .95rem; }
.period-links { display: flex; flex-wrap: wrap; gap: .3rem; }

/* list + details panel */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.ads { display: flex; flex-direction: column; min-width: 0; }

.ad { display: grid; grid-template-columns: 1.6rem auto 1fr auto; grid-template-areas: "kind size tags date" "excerpt excerpt excerpt excerpt";
      gap: .15rem .6rem; align-items: center; padding: .7rem .5rem; text-decoration: none; color: var(--pico-color);
      border-bottom: 1px solid var(--pico-muted-border-color); }
.ad:hover { background: var(--pico-card-sectioning-background-color); }
.ad .kind { grid-area: kind; }
.ad .size { grid-area: size; font-weight: 700; font-size: 1.1rem; white-space: nowrap; }
.ad .tags { grid-area: tags; display: flex; gap: .3rem; flex-wrap: wrap; }
.ad .date { grid-area: date; font-size: .85rem; white-space: nowrap; }
.ad .excerpt { grid-area: excerpt; font-size: .9rem; color: var(--pico-muted-color);
               overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tag { font-size: .8rem; padding: .05rem .45rem; border-radius: 999px; background: var(--pico-card-sectioning-background-color);
       border: 1px solid var(--pico-muted-border-color); }
.kind.seek, .panel .kind.seek { color: var(--pico-primary); }
.empty { padding: 2rem 0; }

.pages { display: flex; flex-wrap: wrap; gap: .3rem; margin: 1rem 0; }
.pages a, .pages span { min-width: 2.2rem; text-align: center; padding: .3rem .5rem; border-radius: var(--pico-border-radius);
                        text-decoration: none; }
.pages a[aria-current] { background: var(--pico-primary-background); color: var(--pico-primary-inverse); }

.panel { display: none; }
.panel-head { display: flex; align-items: center; gap: .8rem; }
.panel-head .close { margin-left: auto; font-size: 1.3rem; text-decoration: none; color: var(--pico-muted-color); padding: 0 .3rem; }
.panel-size { margin: .5rem 0 .2rem; }
.panel-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 1rem 0; }
.tg-button { width: 100%; margin-bottom: 1rem; }
.tg-embed iframe { width: 100%; height: 480px; border: 0; }
.backdrop { display: none; }

/* desktop: the panel is a column next to the list */
@media (min-width: 900px) {
  .filters-toggle { display: none; }
  .filters, .filters.open { display: flex; }
  .ad { grid-template-columns: 1.6rem 9.5rem 9rem 1fr auto; grid-template-areas: "kind size tags excerpt date"; }
  .ad .excerpt { -webkit-line-clamp: 1; }
  .layout:has(.panel.open) { grid-template-columns: minmax(0, 1fr) minmax(320px, 40%); }
  .layout:has(.panel.open) .ad { grid-template-columns: 1.6rem auto 1fr auto; grid-template-areas: "kind size tags date" "excerpt excerpt excerpt excerpt"; }
  .panel.open { display: block; position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto;
                padding: 1rem 1.25rem; border-radius: var(--pico-border-radius);
                background: var(--pico-card-background-color); box-shadow: var(--pico-card-box-shadow); }
}

/* phone/tablet: the panel is a sheet sliding up from the bottom */
@media (max-width: 899px) {
  .panel { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; max-height: 85vh; overflow: auto;
           padding: 1rem 1rem 1.5rem; border-radius: 1rem 1rem 0 0; background: var(--pico-background-color);
           box-shadow: 0 -4px 24px rgba(0, 0, 0, .25); transform: translateY(105%); transition: transform .2s ease-out;
           visibility: hidden; }
  .panel.open { transform: none; visibility: visible; }
  .backdrop.open { display: block; position: fixed; inset: 0; z-index: 10; background: rgba(0, 0, 0, .4); }
  .toplinks { gap: .8rem; font-size: .9rem; }
  /* the period choice scrolls sideways instead of taking two rows */
  .period-links { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; padding-bottom: .2rem; }
  .period-links a { white-space: nowrap; }
}

/* info page */
.info { max-width: 48rem; }
