/* Tracks page (src/components/tracks-page.mjs): every track written out under the page's heading,
   where the homepage has its card deck. Three levels, told apart by size and fill, not by boxes:
     Grand Prize   the page's one panel, filled with the accent
     a track       an open row under a hairline: logo, headline and challenge, prize; its full
                   brief is closed under them until asked for
     unannounced   the same row in the same type, what is to come blurred in its place
   The accent is kept for the heading and the Grand Prize; labels are ink, small capitals.
   The columns are shared, so the headlines and the prizes each line up down the page. Prose keeps a
   reading measure inside its column. On a narrower screen the prize goes under the challenge, and on a
   phone everything stacks. */
.track-panels{
  --track-ink:var(--current-color-10);
  --track-quiet:color-mix(in srgb,var(--current-color-10) 62%,var(--current-surface));
  --track-body:color-mix(in srgb,var(--current-color-10) 80%,var(--current-surface));
  --track-gap:calc(48*var(--dp));
  --track-row-gap:var(--stack-action);
  --track-sign:calc(.7*var(--text-xl));
  color:var(--track-ink);
  margin:var(--stack-action) auto 0;
  position:relative;
  width:var(--nav-width);
}
.track-panels :where(ul,ol,p,h2,h3,h4){margin:0;padding:0}
.track-panels :where(ul,ol){list-style:none}
/* the captured sheet sets lists to font-size:0 and line-height:0 */
.track-panels :where(ul,ol,li){font-size:inherit;line-height:inherit}
.track-panels :where(p,li) a{
  color:inherit;
  text-decoration:none;
}
.track-panels__lead{
  color:var(--track-body);
  font-size:var(--text-md);
  line-height:1.5;
  max-width:40em;
  text-wrap:pretty;
}
/* the page's columns, the last for the plus of a row that opens; without one, the prize runs on into
   it. Every track takes them by subgrid, the Grand Prize's padding included */
.track-panels__list{
  column-gap:var(--track-gap);
  display:grid;
  grid-template-columns:minmax(0,3fr) minmax(0,6fr) minmax(0,3fr) var(--track-sign);
  margin-top:var(--space-heading);
}
.track-panels__notes{
  border-top:1px solid var(--nav-hairline);
  color:var(--track-quiet);
  display:grid;
  font-size:var(--text-sm);
  gap:var(--stack-pair);
  line-height:1.5;
  padding-top:var(--stack-action);
}

.track-panel{
  align-items:start;
  display:grid;
  grid-column:1/-1;
  grid-template-columns:subgrid;
  row-gap:var(--track-row-gap);
  padding-block:var(--stack-action);
  /* a track opened from a homepage card (/tracks/#id) lands clear of the navbar */
  scroll-margin-top:calc(var(--recreated-section-anchor-offset) + var(--stack-lead));
}
.track-panel:not(.is-featured) + .track-panel{border-top:1px solid var(--nav-hairline)}

.track-panel__marks{
  align-items:center;
  display:flex;
  gap:.75rem;
  /* the height of a headline's first line, so the logo centres on it */
  height:calc(1.2*var(--text-xl));
  min-width:0;
}
/* no max-width in percent: the link round the mark takes its width from it, and Safari on iPhone
   settles that loop at a width of nothing (as on the homepage's cards, home.css) */
.track-panel__logo{
  -webkit-mask-position:left center;
  mask-position:left center;
  -webkit-mask-repeat:no-repeat;
  mask-repeat:no-repeat;
  -webkit-mask-size:contain;
  mask-size:contain;
  background-color:var(--track-ink);
  display:block;
  height:max(calc(28*var(--dp)),24px);
  transition:background-color var(--hover-transition);
}
.track-panel__logo--bilt{height:max(calc(20*var(--dp)),17px)}
.track-panel__logo--vert{height:max(calc(22*var(--dp)),18px)}
.track-panel:not(.is-featured) .event-logo-link:is(:hover,:focus-visible) .track-panel__logo{background-color:var(--current-accent)}
.track-panel__times{font-size:var(--text-md);line-height:1}

.track-panel__title{
  font-family:var(--font-heading)!important;
  font-size:var(--text-xl);
  font-weight:var(--font-heading-weight);
  letter-spacing:-.02em;
  line-height:1.2;
  text-wrap:balance;
}
.track-panel__challenge{
  font-size:var(--text-md);
  line-height:1.4;
  margin-top:var(--stack-pair);
}
.track-panel__body,
.track-panel__items{
  color:var(--track-body);
  font-size:var(--text-base);
  line-height:1.6;
  max-width:40em;
  text-wrap:pretty;
}
.track-panel__body + .track-panel__body{margin-top:var(--stack-pair)}
.track-panel__link{font-size:var(--text-sm);margin-top:var(--stack-lead)}
/* a label as on the homepage's cards: small capitals in the system face (typography.css) */
.track-panel__label{
  font-size:var(--text-xs);
  font-weight:500;
  letter-spacing:.04em;
  line-height:1.4;
  text-transform:uppercase;
  margin-bottom:calc(.5*var(--stack-pair));
}
.track-panel__items{display:grid;gap:calc(.5*var(--stack-pair))}
.track-panel__items strong{color:var(--track-ink);font-weight:500}
.track-panel__items--inline{display:flex;flex-wrap:wrap;gap:.25rem 0}
.track-panel__items--inline li:not(:last-child)::after{content:"·";margin-inline:.5em;opacity:.6}

.track-panel:not(.has-brief) .track-panel__facts{grid-column:3/-1}
.track-panel__facts{display:grid;row-gap:calc(1.5*var(--stack-lead))}
.track-panel__facts .track-panel__label{color:var(--track-quiet)}
.track-panel__value{font-size:var(--text-md);font-weight:500;line-height:1.35;text-wrap:pretty}
.track-panel__note{
  color:var(--track-quiet);
  font-size:var(--text-sm);
  line-height:1.55;
  margin-top:var(--stack-pair);
  max-width:40em;
}
/* The brief: straight under the headline, in its column, its parts one after another; the prize keeps
   to its own column beside it, however long it runs, so every track opens the same three columns.
   The headline is the button and the whole row its press area; the plus stands in the last column,
   level with the headline. The plus and the motion are the FAQ's (home.css). */
.track-panel.has-brief{
  --faq-duration:.5s;
  /* shut, the brief has no height but the row's gap over it stays, so that gap counts as part of the
     space at the panel's foot; open, the parts bring their own (below) */
  padding-bottom:calc(var(--stack-action) - var(--track-row-gap));
  position:relative;
}
.track-brief__toggle{
  color:inherit;
  cursor:pointer;
  display:inline;
  font:inherit;
  letter-spacing:inherit;
  line-height:inherit;
  padding:0;
  text-align:left;
  text-wrap:inherit;
}
.track-brief__toggle::before{
  content:"";
  inset:0;
  position:absolute;
}
/* over the press area: the logo's link, and the brief, whose text can be selected */
.has-brief :is(.event-logo-link,.track-panel__link a),
.track-brief{
  position:relative;
  z-index:1;
}
.track-brief{grid-column:2/-1}
.has-brief > .event-faq__sign{
  color:var(--track-quiet);
  font-size:var(--text-xl);
  grid-column:-2;
  grid-row:1;
  /* centred on the headline's first line */
  margin-top:.25em;
  pointer-events:none;
  transition:color var(--hover-transition);
}
.has-brief:has(.track-brief__toggle:is(:hover,:focus-visible)) > .event-faq__sign,
.has-brief.is-open > .event-faq__sign{color:var(--track-ink)}
.has-brief.is-open > .event-faq__sign::after{rotate:0deg}
.has-brief.is-open > .event-faq__sign::before{rotate:-180deg}
.track-brief__parts{
  display:grid;
  gap:var(--stack-action);
  padding-bottom:var(--track-row-gap);
}
/* wide, the prize runs down beside the headline and the brief both; its margin keeps the row's gap
   under it when it is the longer, so a shut row ends the same way whichever column is taller */
@media (min-width:1101px){
  .track-panel.has-brief .track-panel__facts{
    grid-column:3;
    grid-row:1/span 2;
    margin-bottom:var(--track-row-gap);
  }
  .track-panel.has-brief .track-brief{grid-column:2;grid-row:2}
}
/* the answer's own paragraph look is the FAQ's; here the parts open as one */
.track-brief.event-faq__answer p{
  color:var(--track-body);
  line-height:1.6;
  max-width:40em;
  opacity:1;
  padding:0;
  translate:none;
}

/* The Grand Prize: filled. Its logos and title, then its three facts in a row, each the same label,
   value and note, on the page's columns: the prize under the headlines' edge, the judges under the
   other prizes'. */
.track-panel.is-featured{
  --track-ink:var(--current-surface);
  --track-quiet:var(--current-surface);
  --track-body:var(--current-surface);
  background-color:var(--current-accent);
  border-radius:var(--radius-card);
  color:var(--track-ink);
  margin-bottom:var(--stack-action);
  padding:clamp(1.25rem,calc(40*var(--dp)),2.5rem);
}
.track-panel.is-featured :is(.track-panel__marks,.track-panel__main,.track-panel__facts){grid-column:1/-1}
.track-panel.is-featured .track-panel__main{margin-top:calc(-.5*var(--stack-action))}
.track-panel.is-featured .track-panel__facts{grid-template-columns:subgrid}
.track-panel.is-featured .track-panel__facts > :last-child{grid-column:3/-1}
.track-panel.is-featured .track-panel__value{font-size:var(--text-lg);font-weight:500}
.track-panel.is-featured .track-panel__note{font-size:var(--text-base)}
.track-panel.is-featured .track-panel__title{font-size:var(--text-4xl);letter-spacing:-.04em;line-height:1}

@media (max-width:1100px){
  .track-panels__list{grid-template-columns:minmax(0,3fr) minmax(0,9fr) var(--track-sign)}
  .track-panel:not(.is-featured){--track-row-gap:calc(1.5*var(--stack-lead))}
  .track-panel:not(.is-featured) .track-panel__facts{grid-column:2/-1}
  /* two columns are too few for three facts, so they take their own */
  .track-panel.is-featured .track-panel__facts{
    column-gap:calc(.5*var(--track-gap));
    grid-template-columns:minmax(0,3fr) minmax(0,5fr) minmax(0,3fr);
  }
  .track-panel.is-featured .track-panel__facts > :last-child{grid-column:auto}
}
@media (max-width:768px){
  .track-panels__list{grid-template-columns:minmax(0,1fr) var(--track-sign)}
  .track-panel.is-featured .track-panel__facts{grid-template-columns:minmax(0,1fr)}
  /* the plus is level with the logo */
  .track-panel:not(.is-featured) :is(.track-panel__main,.track-panel__facts),
  .track-brief{grid-column:1/-1}
  .track-brief__parts{row-gap:calc(1.5*var(--stack-lead))}
  .track-panel:not(.is-featured) .track-panel__marks{margin-bottom:calc(-1*var(--stack-pair))}
}
