/*
 * css/erdos.css: /erdos and /erdos/<n>, the Erdős spotlights. The index is a framed grid of the ten problems under
 * today's problem (.potd lives in css/site.css, the landing uses it too). A spotlight is a reading column (plain words,
 * why it matters, the prize as history, the Lean statement with numbered marks and a part by part guide) beside a
 * sticky vault panel from 1024 px. Tokens and components from css/base.css, css/components.css, css/gov.css.
 */

.spot-head__art { width: 280px; height: auto; }
.spot-today { margin-bottom: var(--brand-space-2xl); }
.spot-all { padding-bottom: var(--brand-space-3xl); }

/* ---------------------------------------------------------------- index cards */

.spot-grid { align-items: stretch; }
.spot-card { display: block; scroll-margin-top: var(--brand-space-xl); }
.spot-card:target { outline: 1px solid var(--brand-accent); outline-offset: 3px; }
.spot-card__inner { height: 100%; align-content: start; }
.spot-card__top { display: flex; align-items: center; gap: 14px; }
.spot-card__n {
  display: inline-grid; place-items: center;
  min-width: 52px; height: 52px; padding: 0 8px;
  font-family: var(--brand-font-display); font-size: 1.375rem; line-height: 1;
  color: var(--brand-accent-strong);
  border: 1px solid var(--brand-border);
  box-shadow: inset 0 0 0 3px var(--brand-bg-muted), inset 0 0 0 4px var(--brand-border-subtle);
}
.spot-card__title { margin: 0; }
.spot-card__text { margin: 0; }
.spot-card__pool { font-weight: 500; color: var(--brand-text-primary); letter-spacing: 0; }

/* ---------------------------------------------------------------- one problem */

.spot { display: grid; gap: var(--brand-space-2xl); align-items: start; padding-bottom: var(--brand-space-2xl); }
.spot-main { min-width: 0; }
.spot-aside { min-width: 0; }
@media (min-width: 1024px) {
  .spot { grid-template-columns: minmax(0, 1fr) 360px; gap: var(--brand-space-3xl); }
  .spot-aside { position: sticky; top: calc(var(--brand-nav-height) + var(--brand-space-lg)); }
}
.spot-sec { scroll-margin-top: var(--brand-space-xl); }
.spot-sec__title { margin: 0; }
.spot-prose p { margin: 0 0 1em; }
.spot-prose p:last-child { margin-bottom: 0; }
.spot-history { max-width: 68ch; }
.spot-sub { margin: var(--brand-space-md) 0 0; font-family: var(--brand-font-display); font-size: 1.25rem; line-height: 1.3; font-weight: 400; color: var(--brand-text-primary); }
.spot-lean__intro, .spot-claim { margin: 0; max-width: 68ch; color: var(--brand-text-body); line-height: 1.6; }
.spot-code, .guide__code {
  font-family: var(--brand-font-label); font-size: .86em; letter-spacing: 0; text-transform: none;
  padding: 1px 5px; background: var(--brand-bg-elevated); border: 1px solid var(--brand-border-subtle);
  overflow-wrap: anywhere;
}

/* the Lean block: a double frame, line numbers from the file, numbered marks on the parts the guide reads */
.lean-fig { margin: 0; display: grid; gap: 8px; min-width: 0; }
.lean-fig__cap { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.lean-fig__path { display: inline-flex; align-items: center; gap: 6px; font-family: var(--brand-font-label); font-size: 12px; letter-spacing: .04em; }
.lean-fig__path svg { width: 12px; height: 12px; }
.lean {
  margin: 0;
  padding: 18px 18px 18px 0;
  overflow-x: auto;
  background: var(--brand-bg-muted);
  border: 1px solid var(--brand-border);
  box-shadow: inset 0 0 0 4px var(--brand-bg-muted), inset 0 0 0 5px var(--brand-border-subtle);
  font-family: var(--brand-font-label);
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--brand-text-primary);
  white-space: pre;
  tab-size: 2;
  -webkit-overflow-scrolling: touch;
}
.lean:focus-visible { outline: 2px solid var(--brand-accent); outline-offset: 2px; }
.lean code { font: inherit; }
.lean__no {
  display: inline-block; width: 3.4em; padding-right: 1em; margin-right: .9em;
  text-align: right; color: var(--brand-text-muted); border-right: 1px solid var(--brand-border-subtle);
  user-select: none; -webkit-user-select: none;
}
.lean__mark {
  position: relative;
  padding: 1px 2px;
  color: inherit;
  background: var(--brand-accent-soft);
  border-bottom: 1px solid color-mix(in srgb, var(--brand-accent) 55%, transparent);
}
.lean__mark::after {
  content: attr(data-step);
  position: relative; top: -.6em;
  margin-left: 2px;
  font-size: 9.5px; line-height: 0;
  color: var(--brand-accent-readable);
}

/* the guide: numbered like the marks */
.guide { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; counter-reset: guide; max-width: 76ch; }
.guide__item {
  counter-increment: guide;
  display: grid; grid-template-columns: 2.25rem minmax(0, 1fr); column-gap: 12px; row-gap: 6px;
  padding: 14px 0;
  border-top: 1px solid var(--brand-border-subtle);
}
.guide__item:last-child { border-bottom: 1px solid var(--brand-border-subtle); }
.guide__item { position: relative; }
/* the step number, upright, on an engraved diamond (::after) */
.guide__item::before {
  content: counter(guide);
  grid-row: 1 / span 2;
  justify-self: start; align-self: start;
  position: relative; z-index: 1;
  display: inline-grid; place-items: center;
  width: 28px; height: 28px;
  font-family: var(--brand-font-label); font-size: 11px;
  color: var(--brand-accent-readable);
}
.guide__item::after {
  content: '';
  position: absolute; left: 5px; top: 19px;
  width: 18px; height: 18px;
  border: 1px solid var(--brand-border-strong);
  background: var(--brand-bg);
  transform: rotate(45deg);
}
.guide__item:last-child::before { content: ''; }
.guide__item:last-child::after { width: 8px; height: 8px; left: 10px; top: 24px; }
.guide__code { justify-self: start; max-width: 100%; white-space: pre-wrap; line-height: 1.6; }
.guide__note { margin: 0; color: var(--brand-text-body); line-height: 1.55; }

/* the vault panel */
.spot-vault .panel { gap: var(--brand-space-md); }
.spot-vault__usd { font-size: 2.25rem; }
.spot-patrons { display: grid; gap: 8px; }
.spot-patrons__list { list-style: none; margin: 0; padding: 0; display: grid; }
.spot-patrons__list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--brand-border-subtle); }
.spot-vault__actions .row { flex-wrap: wrap; }
.spot-vault__actions .btn svg { width: 14px; height: 14px; }

/* previous / next */
.spot-pager { display: grid; gap: var(--brand-space-md); padding-bottom: var(--brand-space-3xl); }
.spot-pager__link { display: block; }
.spot-pager__link .frame__inner { display: grid; gap: 6px; }
.spot-pager__t { font-family: var(--brand-font-display); font-size: 1.125rem; line-height: 1.35; color: var(--brand-text-primary); }
.spot-pager__link--next .frame__inner { justify-items: end; text-align: right; }
@media (min-width: 768px) { .spot-pager { grid-template-columns: 1fr 1fr; } }
@media (max-width: 599px) {
  .lean { font-size: 12.5px; }
  .spot-head__art { width: 200px; }
}

/* phones and tablets: the pool and Give right under the head (the full vault panel follows the text) */
.spot-quick { margin-bottom: var(--brand-space-xl); }
.spot-quick .frame__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding-block: 14px; }
.spot-quick__pool { display: grid; gap: 4px; }
.spot-quick__usd { font-family: var(--brand-font-display); font-size: 1.75rem; line-height: 1; color: var(--brand-text-primary); }
@media (min-width: 1024px) { .spot-quick { display: none; } }
