#import "misc.typ": ored

#let solution_warning() = {
  set text(ored)
  align(
    center,
    block(
      width: 60%,
      height: auto,
      breakable: false,
      fill: rgb(255, 255, 255),
      stroke: ored + 2pt,
      inset: 3mm,
      (
        align(center, text(weight: "bold", size: 12pt, [Instructor's Handout]))
          + parbreak()
          + align(
            left,
            text(
              size: 10pt,
              [
                This handout contains solutions and notes. \
                Recompile without solutions before distributing.
              ],
            ),
          )
      ),
    ),
  )
}

#let make_header(
  title,
  subtitle: none,
  by: none,
  top_left: "",
  top_right: "",
) = {
  let date = datetime
    .today()
    .display("[month repr:long] [day padding:none], [year]")

  if (by != none) {
    by = text(size: 10pt, [Prepared by #by on #date])
  }

  // Main title
  align(
    center,
    block(
      width: 60%,
      height: auto,
      breakable: false,
      align(
        center,
        stack(
          spacing: 7pt,
          // Top
          text(size: 10pt, top_left) + h(1fr) + text(size: 10pt, top_right),
          line(length: 100%, stroke: 0.2mm),
          // Title
          text(size: 20pt, title),
          // Subtitle
          if (by != none) { text(size: 10pt, by) },
          if (subtitle != none) { text(size: 10pt, subtitle) },
          line(length: 100%, stroke: 0.2mm),
        ),
      ),
    ),
  )
}