/* Public entry list per class, section #meldeliste of the event page (templates/public_entries/_parts.html,
   templates/event/show.html). Phone first: search, folded class tree, cards. From 960px two columns with the
   tree as sticky sidebar, from 1200px the cards in two columns. Only theme tokens of tpss.css (light and dark). */

/* Section on the event page (full width below the overview) and the blocks after it */
.ev-list { scroll-margin-top: 16px; }
.ev-list__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px;
  padding-bottom: 14px; border-bottom: 2px solid var(--line); }
.ev-list__title { font-family: var(--font-display); font-weight: 800; font-size: clamp(28px, 2vw + 18px, 40px); line-height: 1;
  text-transform: uppercase; letter-spacing: .005em; color: var(--ink); }
.ev-list .pent { margin-top: 20px; }
.ev-rest { display: flex; flex-direction: column; gap: 24px; }
.ev-rest__pair { align-items: start; }
.ev-rest__stack { display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 720px) { .ev-rest__pair.grid-2 { grid-template-columns: minmax(0, 1fr); } }

.pent-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.pent-aside { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.pent-main { min-width: 0; }

/* Search */
.pent-search { display: flex; flex-direction: column; gap: 6px; }
.pent-search__row { display: flex; gap: 8px; }
.pent-search__row .input { flex: 1 1 auto; min-width: 0; }
.pent-search__row .btn { flex: none; }

/* Class tree */
.pent-tree { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.pent-tree__summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-height: var(--touch);
  padding: 10px 16px; cursor: pointer; list-style: none; }
.pent-tree__summary::-webkit-details-marker { display: none; }
.pent-tree__summary::after { content: ""; width: 9px; height: 9px; margin-left: auto; align-self: center;
  border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: rotate(45deg) translateY(-2px);
  transition: transform var(--dur) var(--ease); }
.pent-tree[open] > .pent-tree__summary::after { transform: rotate(-135deg) translateY(-2px); }
.pent-tree__current { font-size: 14px; color: var(--ink-2); }
.pent-tree__nav { padding: 4px 8px 10px; border-top: 1px solid var(--line-soft); }

.pent-nodes { list-style: none; margin: 0; padding: 0; }
.pent-nodes .pent-nodes { padding-left: 14px; }

.pent-node { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 36px; padding: 6px 10px 6px 12px; border-radius: var(--r-sm); color: var(--ink-soft); text-decoration: none;
  font-size: 15px; line-height: 1.25; }
.pent-node:hover { background: var(--brand-tint); color: var(--ink); }
.pent-node__label { min-width: 0; overflow-wrap: anywhere; }
.pent-node__sub { display: block; margin-top: 1px; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.pent-node__count { flex: none; min-width: 2.2em; padding: 1px 8px; border-radius: var(--r-pill); background: var(--surface-2);
  color: var(--ink-soft); font-size: 13px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.pent-node--root { font-weight: 700; color: var(--ink); }
.pent-node--d1 { font-weight: 700; color: var(--ink); }
.pent-node.is-empty { color: var(--ink-2); }
.pent-node.is-empty .pent-node__count { background: transparent; color: var(--ink-2); font-weight: 500; }
.pent-node.is-selected { background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; }
.pent-node.is-selected::before { content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 4px;
  border-radius: 2px; background: var(--brand-ink); }
.pent-node.is-selected .pent-node__count { background: var(--brand-ink); color: var(--on-fill); }

/* group: link (filters) in the row, the fold toggle sits at its left (summary of the <details> below) */
.pent-gi { position: relative; }
.pent-gi > .pent-node { margin-left: 22px; }
.pent-group__toggle { position: absolute; top: 0; left: 0; display: flex; align-items: center; justify-content: center;
  width: 24px; height: 36px; border-radius: var(--r-xs); list-style: none; cursor: pointer; }
.pent-group__toggle::-webkit-details-marker { display: none; }
.pent-group__toggle::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--ink-2);
  border-bottom: 2px solid var(--ink-2); transform: rotate(-45deg); transition: transform var(--dur) var(--ease); }
.pent-group__toggle:hover { background: var(--surface-2); }
.pent-group[open] > .pent-group__toggle::before { transform: rotate(45deg); }
.pent-group .pent-nodes { padding-left: 17px; }

/* Bar above the cards */
.pent-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }

/* Class cards */
.pent-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
/* Empty LK cells only hold the place in the two-column grid (wide screens). */
.pent-spacer { display: none; }
.pent-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px 6px;
  scroll-margin-top: 16px; }
.pent-card:target { border-color: var(--brand-ink); box-shadow: 0 0 0 2px var(--brand-line); }
.pent-card--empty { background: transparent; border-style: dashed; border-color: var(--line-strong); padding-bottom: 14px; }
.pent-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); }
.pent-card--empty .pent-card__head { border-bottom: 0; padding-bottom: 0; }
.pent-card__titles { min-width: 0; }
.pent-card__title { font-family: var(--font-display); font-weight: 800; font-size: 28px; line-height: 1; text-transform: uppercase;
  letter-spacing: .005em; color: var(--ink); overflow-wrap: anywhere; }
.pent-card--empty .pent-card__title { color: var(--ink-2); }
.pent-card__path { margin-top: 4px; font-size: 14px; color: var(--ink-2); }
.pent-card__count { flex: none; text-align: right; line-height: 1; color: var(--ink-2); font-size: 13px; }
.pent-card__n { display: block; font-family: var(--font-display); font-weight: 800; font-size: 28px; color: var(--brand-ink);
  font-variant-numeric: tabular-nums; }
.pent-card--empty .pent-card__n { color: var(--ink-2); }
.pent-card__none { margin-top: 6px; font-size: 14px; color: var(--ink-2); }
.pent-card__matches { margin-top: 8px; }

.pent-rows { list-style: none; margin: 0; padding: 0; }
.pent-row { display: grid; grid-template-columns: 2.2em minmax(0, 1fr) auto; align-items: center; gap: 4px 10px;
  padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.pent-rows:last-child > .pent-row:last-child { border-bottom: 0; }
.pent-row__n { color: var(--ink-2); font-size: 14px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.pent-row__main { min-width: 0; }
.pent-row__name { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.pent-row__club { margin-top: 2px; font-size: 14px; color: var(--ink-2); overflow-wrap: anywhere; }
.pent-row__clubname + .pent-row__country::before { content: " · "; }
.pent-row__flag { font-size: 26px; line-height: 1; }

/* "Show N more" */
.pent-more { border-top: 1px solid var(--line-soft); }
.pent-more__summary { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--touch);
  list-style: none; cursor: pointer; color: var(--brand-ink); font-weight: 700; font-size: 14px; text-transform: uppercase;
  letter-spacing: .04em; }
.pent-more__summary::-webkit-details-marker { display: none; }
.pent-more__summary::after { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); }
.pent-more__summary:hover { text-decoration: underline; text-underline-offset: 3px; }
.pent-more[open] > .pent-more__summary { display: none; }
.pent-more[open] { border-top: 0; }
.pent-more[open] .pent-rows { border-top: 1px solid var(--line-soft); }
/* JS search: every hit is shown, the fold is open and its button hidden */
.pent.is-filtering .pent-more__summary { display: none; }
.pent.is-filtering .pent-more { border-top: 0; }

@media (min-width: 600px) {
  .pent-card { padding: 16px 20px 8px; }
  .pent-card__title, .pent-card__n { font-size: 32px; }
}

@media (min-width: 960px) {
  .pent-layout { grid-template-columns: 300px minmax(0, 1fr); gap: 24px; }
  .pent-aside { position: sticky; top: calc(var(--sticky-pad, var(--header-h)) + 8px); max-height: calc(100vh - var(--sticky-pad, var(--header-h)) - 24px); }
  .pent-tree { display: flex; flex-direction: column; min-height: 0; }
  .pent-tree[open] { overflow: auto; overscroll-behavior: contain; }
  /* opened by JS on wide screens: the summary only takes room there when folded */
  .pent-tree[open] > .pent-tree__summary { display: none; }
  .pent-tree[open] .pent-tree__nav { border-top: 0; padding-top: 8px; }
}

@media (min-width: 1200px) {
  .pent-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  /* One row per weight class: LK1 left, LK2 right; a missing LK leaves its cell empty. */
  .pent-cell--lk1 { grid-column: 1; }
  .pent-cell--lk2 { grid-column: 2; }
  .pent-cell--row { grid-column: 1 / -1; }
  .pent-spacer { display: block; visibility: hidden; }
  .pent-bar, .pent-cards > p { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  .pent-tree__summary::after, .pent-group__toggle::before { transition: none; }
}
