/* SPDX-License-Identifier: Apache-2.0 */
/* Docs and guides index pages (docs.html, guides.html). Loaded after styles.css and docs.css.
   .guide-card itself lives in styles.css; these are small layout tweaks for the index grids. */

.page-index .article-section { margin: 34px 0; }
.page-index .article-section--first { margin-top: 26px; }
.page-index .section-lead { margin-bottom: 0; }
.page-index .guide-grid { margin: 14px 0 0; }

/* Tag sits on the bottom edge, so cards in one row line up. */
.page-index a.guide-card {
  display: flex;
  flex-direction: column;
}
/* The filter hides cards that don't match; the display rules here would
   otherwise keep them on screen (#186). */
.page-index a.guide-card[hidden] { display: none !important; }
.page-index a.guide-card .tag {
  align-self: flex-start;
  margin-top: auto;
  padding-top: 10px;
}

/* A card that spans the whole row (the "start here" card). */
.page-index .guide-grid a.guide-card.is-wide {
  grid-column: 1 / -1;
  min-height: 0;
}

/* Small line icon in front of a section heading. */
.page-index .article-section > h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}
.page-index .h2-ico {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linejoin: round;
}
.page-index .h2-ico.is-radio { stroke: var(--orange); }

/* On phones the site-wide 16px paragraph rule makes card text larger than its title. */
@media (max-width: 960px) {
  .page-index .guide-card h2 { font-size: 15px; }
  .page-index .guide-card p {
    font-size: 14px;
    line-height: 1.5;
  }
}

/* #171: skip link, filter, jump bar, compact rows on phones. */
.skip-link {
  position: absolute;
  left: 8px;
  top: -60px;
  z-index: 50;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--accent);
  color: var(--accent);
}
.skip-link:focus { top: 8px; }
.page-index:focus { outline: none; }

/* Three featured cards side by side; only these repeat a category card. */
.page-index .start-grid { grid-template-columns: repeat(3, 1fr); }
.page-index .start-grid a.guide-card.featured { grid-column: auto; }

/* #177: the two antenna guides are featured, side by side, with a line drawing. */
.page-index .ant-grid a.guide-card.featured { grid-column: auto; }
.page-index .ant-pic {
  width: 64px;
  height: 36px;
  margin-bottom: 8px;
  fill: none;
  stroke: var(--orange);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.index-filter { margin: 18px 0 0; }
.index-filter label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--dim);
}
.index-filter input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  color: var(--fg);
  font: inherit;
  font-size: 15px;
}
.index-filter input:focus-visible { outline: 1px solid var(--accent); border-color: var(--accent); }
.index-filter-status { margin: 6px 0 0; font-size: 12px; color: var(--dim); min-height: 1em; }

.jump-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0 0;
}
.jump-bar a {
  flex: none;
  padding: 4px 10px;
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
.jump-bar a:hover { border-color: var(--orange); }
.jump-bar a[aria-current] { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.page-index section[data-cat] { scroll-margin-top: 16px; }

.index-elsewhere h2 { margin: 28px 0 8px; font-size: 14px; color: var(--purple); }
.index-elsewhere ul { list-style: none; margin: 0; padding: 0; }
.index-elsewhere li { margin: 0 0 8px; }
.index-elsewhere li span { display: block; font-size: 13px; color: var(--dim); }
.index-empty button {
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.index-also { margin-top: 30px; font-size: 14px; }

@media (max-width: 600px) {
  /* The index scrolls with the document here, so the jump bar can stick. */
  .page-wrap:has(.page-index) { overflow: visible; }
  .jump-bar {
    position: sticky;
    top: var(--topbar-h);
    z-index: 5;
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: 12px -16px 0;
    padding: 8px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    scrollbar-width: none;
  }
  .page-index section[data-cat] { scroll-margin-top: calc(var(--topbar-h) + 52px); }
  .page-index .article-section { margin: 18px 0; }
  .page-index .section-lead { font-size: 13px; line-height: 1.4; }
  .page-index .guide-grid,
  .page-index .start-grid { grid-template-columns: minmax(0, 1fr); gap: 6px; margin-top: 10px; }
  .page-index a.guide-card { padding: 8px 12px; min-height: 0; }
  .page-index a.guide-card .tag { display: none; }
  .page-index .guide-card h2,
  .page-index .guide-card p {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .page-index .guide-card h2 { margin-bottom: 2px; }
  .page-index .guide-card p { font-size: 13px; line-height: 1.4; }
  /* Antenna rows stay compact, with the drawing as a small icon on the left. */
  .page-index a.guide-card.ant-card {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    column-gap: 10px;
    align-items: center;
  }
  .page-index .ant-card .ant-pic { grid-row: 1 / 3; width: 32px; height: 18px; margin: 0; }
}

@media (prefers-reduced-motion: no-preference) {
  html:has(.page-index), .page-wrap:has(.page-index) { scroll-behavior: smooth; }
}
