/* Challenge entry: the featured challenge on the start page and one function's own page. */

/* Start page: featured challenge first, the best verified record beside it. */
.featured {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr);
  margin-bottom: clamp(2rem, 4vw, 2.75rem);
}
@media (min-width: 52rem) {
  .featured:not(.single) {
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    align-items: stretch;
  }
}
.feature-card,
.record-card,
.scorecard {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: clamp(1.25rem, 3vw, 1.75rem);
}
.feature-card {
  display: grid;
  gap: 0.6rem;
  align-content: start;
  border-color: var(--accent-border);
  box-shadow: 0 1px 0 var(--accent-border);
}
.feature-card h2 a {
  color: inherit;
  text-decoration: none;
}
.feature-card h2 a:hover {
  text-decoration: underline;
}
.feature-task {
  color: var(--ink-soft);
  max-width: 56ch;
}
.feature-status {
  font-family: var(--display);
  font-stretch: 96%;
  font-weight: 700;
  font-size: clamp(1.35rem, 2.6vw, 1.75rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-top: 0.35rem;
}
.feature-status.open {
  color: var(--accent-hover);
}
.feature-card .actions {
  margin-top: 0.75rem;
}
.record-card {
  background: var(--surface);
  display: grid;
  gap: 0.5rem;
  align-content: start;
}
.record-card h2 {
  font-family: var(--text);
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink-soft);
}
.record-figure {
  display: grid;
  gap: 0.15rem;
}
.score-num {
  font-family: var(--mono);
  font-weight: 600;
  font-size: clamp(2.5rem, 7vw, 3.75rem);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--ink);
}
.score-dot {
  margin-inline: -0.2em;
}

/* A problem page's pointer to its featured challenge. */
.featured-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
}

/* Challenge page, first screen. Small screens read task, score, then actions. */
.challenge-top {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "head" "card" "actions";
  padding-top: clamp(0.25rem, 2vw, 1.25rem);
}
@media (min-width: 56rem) {
  .challenge-top {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    grid-template-areas: "head card" "actions card";
    grid-template-rows: auto 1fr;
    gap: 1.5rem 3rem;
  }
}
.challenge-head {
  grid-area: head;
  display: grid;
  gap: 0.6rem;
  align-content: start;
}
.challenge-head .crumbs {
  font-size: var(--text-sm);
  color: var(--ink-soft);
}
.challenge-head .goal {
  color: var(--ink-soft);
  max-width: 48ch;
}
.scorecard {
  grid-area: card;
  display: grid;
  gap: 0.75rem;
  align-content: start;
}
.score-lead {
  font-size: clamp(1.6rem, 3.6vw, 2.25rem);
  line-height: 1.12;
  color: var(--accent-hover);
}
.score-value {
  display: grid;
  gap: 0.35rem;
}
.score-unit {
  font-family: var(--text);
  font-size: var(--text-body);
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink-soft);
}
.score-detail {
  color: var(--ink-soft);
  font-size: var(--text-sm);
}
.score-rule {
  font-size: var(--text-sm);
  text-wrap: pretty;
}
.score-status {
  font-size: var(--text-sm);
  color: var(--ink-soft);
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.challenge-actions {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  align-self: start;
}
.challenge-actions button.link {
  font-size: var(--text-sm);
}
/*
 * One column: "Try this challenge" sits in the scorecard right under the score, so a phone shows
 * it above the statistics question. Two columns: it leads the action row beside the card.
 */
.score-try {
  margin: 0.15rem 0 0.35rem;
}
@media (max-width: 55.99rem) {
  .challenge-actions .top-try {
    display: none;
  }
}
@media (min-width: 56rem) {
  .score-try {
    display: none;
  }
}

/* Taking part: three steps, the details folded away until wanted. */
/* Clear the sticky masthead, which takes two rows on small screens. */
#join,
#scoring,
.board tr[id] {
  scroll-margin-top: 8rem;
}
@media (min-width: 44rem) {
  #join,
  #scoring,
  .board tr[id] {
    scroll-margin-top: 5rem;
  }
}
.join-steps {
  list-style: none;
  counter-reset: join;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  gap: 1.25rem;
  max-width: 46rem;
}
.join-steps > li {
  counter-increment: join;
  position: relative;
  padding-left: 2.6rem;
  display: grid;
  gap: 0.45rem;
  justify-items: start;
}
.join-steps > li::before {
  content: counter(join);
  position: absolute;
  left: 0;
  top: 0;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: var(--text-sm);
  background: var(--accent-tint);
  color: var(--accent-hover);
  border: 1px solid var(--accent-border);
}
.join-steps p {
  color: var(--ink-soft);
}
.join-steps form {
  display: grid;
  justify-items: start;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.join-more {
  margin-top: 1.5rem;
  max-width: 46rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}
.join-more summary {
  cursor: pointer;
  font-weight: 600;
}
.join-more .facts {
  list-style: none;
  margin: 0.9rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
  color: var(--ink-soft);
  font-size: var(--text-sm);
}
.join-more .facts code {
  overflow-wrap: anywhere;
}

/* The old shared link, /p/speed-race#fn-<name>, still lands on and marks its row. */
.board tr:target {
  background: var(--accent-tint);
}
