/* The naming-rights campaign on Name a space (endowment.js). */

.endow {
  padding: 56px 0 64px;
  border-bottom: 2px solid var(--line-strong);
}

.endow__lead {
  max-width: 66ch;
}

.endow__lead .t-body {
  margin-top: 12px;
  font-size: 17px;
  line-height: 1.6;
}

.endow__status {
  margin-top: 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-muted);
}

.endow__progress {
  height: 10px;
  margin-top: 8px;
  max-width: 420px;
  border: 2px solid var(--line-strong);
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) calc(var(--done, 0) * 100%), var(--surface) 0);
}

/* ---- The sum: fund + campaign = endowment → a year of studios ------------- */

.endow__flow {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1.2fr auto 1.2fr;
  align-items: stretch;
  gap: 10px;
  margin-top: 32px;
}

.endow__box {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 18px 18px 16px;
  border: 2px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
}

.endow__box--total {
  background: var(--accent);
  color: var(--on-accent);
}

.endow__box--yearly {
  background: var(--ink);
  color: var(--paper);
}

.endow__figure {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(24px, 2.6vw, 32px);
  line-height: 1.05;
}

.endow__label {
  font-size: 14px;
  line-height: 1.4;
}

.endow__op {
  align-self: center;
  font-family: var(--display);
  font-weight: 900;
  font-size: 26px;
}

.endow__op small {
  display: block;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-align: center;
}

/* ---- Six studios, two terms ------------------------------------------------ */

.endow__year {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 24px;
  margin-top: 22px;
}

.endow__terms {
  display: grid;
  grid-template-columns: repeat(6, 34px);
  grid-template-rows: repeat(2, 34px);
  grid-auto-flow: column;
  gap: 6px;
}

.endow__term {
  border: 2px solid var(--line-strong);
  border-radius: 6px;
  background: linear-gradient(90deg, var(--highlight) calc(var(--fill, 0) * 100%), var(--surface) 0);
  transition: opacity 0.5s;
}

.endow.is-waiting .endow__term {
  background: var(--surface);
}

.endow__year p {
  margin: 0;
  max-width: 56ch;
  font-size: 16px;
  line-height: 1.55;
}

/* ---- One gift, every year ------------------------------------------------- */

.endow__yours {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px;
  margin-top: 40px;
  padding: 26px 28px;
  border: 2px solid var(--line-strong);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 6px 6px 0 var(--line-strong);
}

.endow__yours h3 {
  margin: 4px 0 14px;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(22px, 2.4vw, 28px);
  line-height: 1.1;
}

.endow__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.endow__chip {
  min-height: 44px;
  padding: 8px 14px;
  border: 2px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.endow__chip[aria-pressed='true'] {
  background: var(--accent);
  color: var(--on-accent);
}

.endow__chip:focus-visible,
.endow__years input:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.endow__chip small {
  display: block;
  font-size: 12px;
  font-weight: 600;
}

.endow__years {
  display: grid;
  gap: 6px;
  margin-top: 20px;
  font-size: 14px;
  font-weight: 700;
}

.endow__years input {
  width: 100%;
  accent-color: var(--highlight);
}

.endow__result .endow__figure {
  font-size: clamp(30px, 3.4vw, 42px);
}

.endow__result p {
  margin: 4px 0 0;
  font-size: 16px;
  line-height: 1.55;
}

.endow__weeks {
  display: grid;
  grid-template-columns: repeat(26, 1fr);
  gap: 3px;
  margin: 14px 0 4px;
}

.endow__week {
  aspect-ratio: 1;
  border: 2px solid var(--line-strong);
  border-radius: 3px;
  background: var(--paper);
}

.endow__week.is-on {
  background: var(--highlight);
}

.endow__legend {
  font-size: 13px;
  color: var(--ink-muted);
}

.endow__go {
  margin-top: 18px;
}

.endow__close {
  max-width: 62ch;
  margin-top: 32px;
  font-size: 17px;
  line-height: 1.6;
}

.endow__note {
  max-width: 90ch;
  margin-top: 16px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-muted);
}

@media (max-width: 960px) {
  .endow__flow {
    grid-template-columns: 1fr auto 1fr;
  }

  .endow__flow > :nth-child(4) {
    display: none;
  }

  .endow__box--total {
    grid-column: 1 / -1;
  }

  .endow__flow > .endow__op--draw {
    grid-column: 1 / -1;
    justify-self: center;
  }

  .endow__box--yearly {
    grid-column: 1 / -1;
  }

  .endow__yours {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .endow__year {
    grid-template-columns: 1fr;
  }

  .endow__terms {
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(2, 40px);
  }

  .endow__yours {
    padding: 20px 18px;
  }

  /* The term in two rows of 13 weeks, so each week is big enough to see. */
  .endow__weeks {
    grid-template-columns: repeat(13, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .endow__term {
    transition: none;
  }
}
