/* catalog.css — Styles for the catalog's landing, family, group, and count
 * index pages (generated by tools/make_index_pages.py) and compare.html. */
@import url('theme.css?v=26-12-04-13-22-00');

:root {
  --thumb: 228px;          /* a group card on the family index */
  --pat:   210px;          /* a pattern picture on the count / group pages */
}

/* ---- Page Header ------------------------------------------------------- */

header.top {
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
  padding: 1rem 0 1.05rem;
  margin-bottom: 1.4rem;
}
header.top h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 650;
  letter-spacing: -.01em;
  line-height: 1.2;
}
header.top h1 .sub { color: var(--muted); font-weight: 400; }
header.top .lede {
  margin: .32rem 0 0;
  color: var(--muted);
  font-size: .92rem;
  max-width: 82ch;
}
header.top .lede b { color: var(--ink); font-weight: 600; }

/* Group page title banner */
header.top.group h1 {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .15rem .9rem;
  margin: .1rem 0 .45rem;
  padding: .35rem 1.2rem .42rem .95rem;
  font-size: 2.35rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--accent);
  background: var(--panel);
  border: 1px solid var(--accent-bd);
  border-left: 8px solid var(--accent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
header.top.group h1 .sub { font-size: 1.2rem; font-weight: 400; color: var(--muted); }
header.top.group .lede { font-size: .93rem; }

/* ---- Section Headings -------------------------------------------------- */

h2.sec {
  font-size: .78rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
  margin: 2rem 0 .85rem;
  padding-bottom: .35rem;
  border-bottom: 1px solid var(--line);
}
h2.sec .note {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  margin-left: .5rem;
}
h2.sec a { color: inherit; }
h2.sec .note a { color: var(--accent); }
h2.sec[id] { scroll-margin-top: calc(var(--nav-h) + 3.4rem); }

/* Section banners for symmetry sections, count sections, and group sections */
h2.sec.cnt {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .15rem .9rem;
  margin: 2.2rem 0 .95rem;
  padding: .5rem .85rem;
  font-size: 1.25rem;
  font-weight: 650;
  line-height: 1.25;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
  background: var(--accent-bg);
  border: 1px solid var(--accent-bd);
  border-left: 5px solid var(--accent);
  border-radius: var(--radius-md);
}
h2.sec.cnt > a { color: var(--ink); }
h2.sec.cnt > a:hover { color: var(--accent); }
h2.sec.cnt .note { margin-left: 0; font-size: .84rem; color: var(--muted); }
h2.sec.cnt.none {
  margin: 1.35rem 0 .55rem;
  padding: .32rem .85rem;
  font-size: 1rem;
  color: var(--faint);
  background: transparent;
  border: 1px dashed var(--line);
}
h2.sec.cnt.none .note { color: var(--faint); }

/* ---- Group & Family Cards ---------------------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(var(--thumb), 100%), 1fr));
  gap: 1rem;
}
.grid.families {
  grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr));
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.card.planned {
  opacity: .72;
  border-style: dashed;
  box-shadow: none;
}
.card.planned:hover {
  border-color: var(--line);
  box-shadow: none;
  transform: none;
}

.card .thumb {
  display: block;
  aspect-ratio: var(--panel-aspect, 1);
  background: var(--art-bg);
  border-bottom: 1px solid var(--rule);
  overflow: hidden;
}
.card .thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.grid.families .card .thumb { aspect-ratio: 1; }
.grid.families .card .thumb img { object-fit: contain; }
.ver-card .vthumb { object-fit: contain; background: var(--art-bg); }
.card .thumb.none, .cg .pat.none {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--faint);
  font-size: .82rem;
  background: var(--art-checker);
}
.card .thumb.planned-art {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-alt);
  color: var(--faint);
  font-size: 2rem;
  font-weight: 300;
  letter-spacing: .05em;
}

.card .body, .cg .body {
  padding: .6rem .75rem .7rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.card .body { flex: 1; }
.card .name { font-size: 1.2rem; font-weight: 650; line-height: 1.2; }
.card .name a, .cg .name a { color: var(--ink); }
.card .name a:hover, .cg .name a:hover { color: var(--accent); text-decoration: none; }
.card .name .hm {
  font-size: .84rem;
  font-weight: 400;
  color: var(--muted);
  margin-left: .4rem;
  font-style: italic;
}
.card .desc { margin: .15rem 0 0; font-size: .85rem; color: var(--muted); line-height: 1.45; }
.card .meta, .cg .meta { font-size: .82rem; color: var(--muted); }
.card .meta b { color: var(--ink); font-weight: 600; }

/* ---- Version Cards (Landing Page) -------------------------------------- */

.ver-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: .9rem;
}
.ver-card {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .7rem .85rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.ver-card .vthumb {
  width: 68px;
  height: 68px;
  flex: 0 0 68px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--rule);
  object-fit: cover;
  background: var(--art-bg);
}
.ver-card .vbody { min-width: 0; flex: 1; }
.ver-card .vname {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-weight: 650;
  font-size: 1rem;
}
.ver-card .vlabel { font-size: .84rem; color: var(--muted); margin: .15rem 0 .4rem; }
.ver-card .vacts { display: flex; flex-wrap: wrap; gap: .35rem; }

/* ---- Count Mini-Table inside Cards & Group Facts ----------------------- */

table.counts {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  margin-top: .35rem;
  font-size: .75rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
table.counts th, table.counts td { border: 1px solid var(--rule); padding: .08rem .1rem; }
table.counts tr > :first-child {
  width: 5.4rem;
  text-align: left;
  padding-left: .35rem;
  font-weight: 400;
  color: var(--muted);
  font-size: .7rem;
  white-space: nowrap;
}
table.counts tr:first-child th { background: var(--panel-alt); font-weight: 600; }
table.counts tr:first-child th a { display: block; color: var(--accent); }
table.counts tr:first-child th a:hover { background: var(--accent-bg); text-decoration: none; }
table.counts tr:last-child td { font-weight: 600; }
table.counts .zero { color: var(--faint); font-weight: 400 !important; }

/* ---- Group Page Hero & Facts ------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(210px, 310px) 1fr;
  gap: 1.5rem;
  align-items: start;
}
.hero .hero-media {
  display: flex;
  flex-direction: column;
  gap: .55rem;
}
.hero img {
  width: 100%;
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--art-bg);
  box-shadow: var(--shadow-sm);
}
.hero .hero-live {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
@media (max-width: 680px) { .hero { grid-template-columns: 1fr; } }

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .3rem 1.1rem;
  margin: 0;
  font-size: .92rem;
}
.facts dt { color: var(--muted); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.facts dd.tbl { max-width: 24rem; }

/* ---- Balanced Count Tiles (2..7 colors on one row at desktop) ---------- */

nav.ntiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: .55rem;
}
nav.ntiles a {
  display: block;
  padding: .52rem .7rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink);
  transition: border-color .12s, background-color .12s;
}
nav.ntiles a:hover {
  border-color: var(--accent);
  background: var(--hover-bg);
  text-decoration: none;
}
nav.ntiles a.cur {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}
nav.ntiles b { display: block; font-size: 1rem; margin-bottom: .1rem; }
nav.ntiles span { display: block; font-size: .76rem; line-height: 1.4; color: var(--muted); }
nav.ntiles span.in { color: var(--faint); margin-top: .15rem; }
nav.ntiles a.cur span { color: rgba(255, 255, 255, .86); }
nav.ntiles a.cur span.in { color: rgba(255, 255, 255, .72); }
nav.ntiles div.off {
  padding: .52rem .7rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
}
nav.ntiles div.off b, nav.ntiles div.off span { color: var(--faint); }

/* ---- Sticky Group-Jump Chips (colors/<N>/index.html) ------------------- */

nav.jump-chips {
  position: sticky;
  top: var(--nav-h);
  z-index: 35;
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin: .9rem 0 .4rem;
  padding: .45rem .6rem;
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}
nav.jump-chips a, nav.jump-chips span.off {
  padding: .1rem .48rem;
  font-size: .82rem;
  font-family: var(--mono);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-2);
  text-decoration: none;
}
nav.jump-chips a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
nav.jump-chips a.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}
nav.jump-chips span.off {
  color: var(--faint);
  background: transparent;
  border-style: dashed;
}

/* ---- Pattern Cards & Affine Type Frames -------------------------------- */

.pgrid { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; }

.cg {
  width: calc(var(--k, 1) * var(--pat) + (var(--k, 1) - 1) * 2px + 2px);
  max-width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color .14s, box-shadow .14s;
}
.cg:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.cg .pats {
  display: grid;
  gap: 2px;
  grid-template-columns: repeat(auto-fit, minmax(min(calc(var(--pat) * .6), 100%), 1fr));
  background: var(--rule);
  border-bottom: 1px solid var(--rule);
}
.cg .pat {
  position: relative;
  display: block;
  aspect-ratio: var(--panel-aspect, 1);
  background: var(--art-bg);
}
.cg .pat img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cg .pk {
  position: absolute;
  left: .38rem;
  bottom: .38rem;
  font-family: var(--mono);
  font-size: .78rem;
  line-height: 1.45;
  padding: 0 .32rem;
  border-radius: 3px;
  background: rgba(255, 255, 255, .9);
  color: #181c22;
  border: 1px solid rgba(0, 0, 0, .14);
}
.cg .name { font-size: 1.02rem; font-weight: 600; line-height: 1.25; }
.cg .name .badge { vertical-align: .12em; margin-left: .3rem; font-weight: 500; }

/* Affine equivalence class frame */
.pgrid.typed { gap: 1.05rem; }
.tframe {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  max-width: 100%;
  padding: .55rem;
  background: var(--frame-bg);
  border: 1px solid var(--frame-bd);
  border-radius: var(--radius-lg);
}
.tframe .tframe-row {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  align-items: flex-start;
}
.tframe .tframe-lbl {
  font-size: .72rem;
  line-height: 1.35;
  min-height: 1.35em;
  white-space: nowrap;
  color: var(--muted);
  padding: 0 .2rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}

/* ---- Count Pager ------------------------------------------------------- */

nav.pager {
  display: flex;
  gap: .38rem;
  flex-wrap: wrap;
  margin: .2rem 0 .2rem;
  font-size: .85rem;
}
nav.pager a, nav.pager span {
  padding: .15rem .58rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
}
nav.pager a:hover { border-color: var(--accent); background: var(--accent-bg); text-decoration: none; }
nav.pager .cur { background: var(--accent); color: #ffffff; border-color: var(--accent); font-weight: 600; }
nav.pager .off { color: var(--faint); background: transparent; border-style: dashed; }

@media (max-width: 640px) {
  header.top {
    padding: .75rem 0 .8rem;
    margin-bottom: 1rem;
  }
  header.top h1 { font-size: 1.45rem; }
  header.top.group h1 {
    font-size: 1.75rem;
    padding: .28rem .85rem .32rem .75rem;
  }
  nav.jump-chips {
    position: static;
    gap: .26rem;
    padding: .4rem .5rem;
  }
}
