/* SPDX-License-Identifier: MIT */
/* Provenance: gopuml site/style.css */

/* The palette and the shapes are those of gopuml's page, so that the pages
   of the two projects look alike: #181818 lines, #E2E2F0 boxes, #FEFFDD
   notes, and Go's blue as the accent. */
:root {
  --paper: #f6f6fa;
  --panel: #e2e2f0;
  --ink: #181818;
  --ink-2: #4a4a57;
  --rule: #c9c9d9;
  --note: #feffdd;
  --note-fold: #ecedc4;
  --link: #006a85;
  --go: #007d9c;
  --sheet: #ffffff;

  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --measure: 72rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --radius: 5px;
  --line: 1.5px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16161d;
    --panel: #262633;
    --ink: #e8e8f0;
    --ink-2: #a9a9b8;
    --rule: #3a3a4a;
    --note: #2b2a1a;
    --note-fold: #3d3b22;
    --link: #4fc3e6;
    --go: #0aa0c8;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--sans);
  -webkit-text-size-adjust: 100%;
}

a {
  color: var(--link);
  text-underline-offset: 0.15em;
}

:focus-visible {
  outline: 3px solid var(--go);
  outline-offset: 2px;
}

code,
pre {
  font-family: var(--mono);
  font-size: 0.9em;
}

:not(pre) > code {
  overflow-wrap: anywhere;
  padding: 0.05em 0.3em;
  border-radius: 3px;
  background: color-mix(in srgb, var(--panel) 70%, transparent);
}

pre {
  margin: 1rem 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 45%, var(--paper));
  line-height: 1.5;
  tab-size: 4;
}

h1,
h2,
h3 {
  line-height: 1.15;
  text-wrap: balance;
}

h2 {
  margin: 0 0 1rem;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 650;
}

.skip {
  position: absolute;
  left: -100vw;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 1;
  padding: 0.5rem 0.75rem;
  background: var(--paper);
}

/* Header and footer */

.top,
main,
.bottom {
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 1.25rem;
}

.wordmark {
  color: var(--ink);
  font: 800 1.2rem var(--mono);
  letter-spacing: -0.03em;
  text-decoration: none;
}

.top nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

.top nav a {
  color: var(--ink-2);
  font-size: 0.95rem;
  text-decoration: none;
}

.top nav a:hover {
  color: var(--ink);
  text-decoration: underline;
}

main > section {
  padding-block: 3.5rem;
}

.bottom {
  padding-block: 2.5rem 3.5rem;
  border-top: var(--line) solid var(--ink);
  color: var(--ink-2);
  font-size: 0.95rem;
}

.bottom h2 {
  font-size: 1.1rem;
  color: var(--ink);
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

/* Hero */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2.5rem;
  padding-block: 3rem 4rem;
}

.hero h1 {
  margin: 0 0 1.5rem;
  font: 800 clamp(2.1rem, 4.2vw, 3.5rem) / 1.05 var(--mono);
  letter-spacing: -0.045em;
}

.nowrap {
  white-space: nowrap;
}

.lede {
  max-width: 34em;
  margin: 0 0 2rem;
  color: var(--ink-2);
  font-size: 1.15rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0;
}

.button {
  display: inline-block;
  padding: 0.55rem 1rem;
  border: var(--line) solid var(--ink);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
}

.button.primary {
  background: var(--ink);
  color: var(--paper);
}

@media (prefers-reduced-motion: no-preference) {
  .button {
    transition: box-shadow 120ms ease, transform 120ms ease;
  }
}

/* A drop shadow, as a hover state. */
.button:hover {
  box-shadow: 3px 3px 0 var(--ink-2);
  transform: translate(-1px, -1px);
}

/* The hero sheet: a source, the command, and the graph it renders, framed
   as a box. */
.sheet {
  margin: 0;
  border: var(--line) solid var(--ink);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}

.sheet-label {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--rule);
  color: var(--ink-2);
  font: 600 0.8rem var(--mono);
}

.sheet-source {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 0.82rem;
}

.sheet-command {
  margin: 0;
  padding: 0.45rem 1rem;
  border-block: 1px dashed var(--ink-2);
  font-size: 0.85rem;
}

.sheet-command code {
  padding: 0;
  background: none;
}

.sheet-paper {
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: var(--sheet);
}

.sheet-paper img {
  display: block;
  width: 100%;
  max-width: 26rem;
  height: auto;
}

/* The example of gogv is laid out from left to right, so its sheet puts the
   source beside the picture, which takes the rest of the width. */
.sheet-panes {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.6fr);
}

.sheet-wide .sheet-source {
  border-right: 1px solid var(--rule);
}

.sheet-result {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sheet-wide .sheet-command {
  border-top: 0;
}

.sheet-wide .sheet-paper {
  flex: 1;
}

.sheet-wide .sheet-paper img {
  max-width: 100%;
}

/* Notes: a note shape, with its folded corner. */
.note {
  --fold: 14px;
  position: relative;
  max-width: 46rem;
  margin: 1.25rem 0;
  padding: 0.8rem 2rem 0.8rem 1rem;
  border: 1px solid var(--ink);
  background: var(--note);
  font-size: 0.95rem;
  clip-path: polygon(0 0, calc(100% - var(--fold)) 0, 100% var(--fold), 100% 100%, 0 100%);
}

.note::after {
  content: "";
  position: absolute;
  top: -1px;
  right: -1px;
  width: calc(var(--fold) + 1px);
  height: calc(var(--fold) + 1px);
  border-bottom: 1px solid var(--ink);
  border-left: 1px solid var(--ink);
  background: linear-gradient(to bottom left, transparent calc(50% - 0.75px), var(--ink) calc(50% - 0.75px), var(--ink) calc(50% + 0.75px), var(--note-fold) calc(50% + 0.75px));
}

/* Three ways */

.ways {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem 2.5rem;
}

.ways article {
  padding-top: 1rem;
  border-top: var(--line) solid var(--ink);
}

.ways p {
  margin: 0 0 0.75rem;
  color: var(--ink-2);
}

/* Three columns are narrow for code, so it wraps instead of scrolling,
   which would hide the end of its lines. */
.ways pre {
  margin: 0;
  font-size: 0.82rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Output formats and sources */

.formats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}

.formats code {
  display: inline-block;
  padding: 0.3em 0.6em;
  border: 1px solid var(--rule);
}

.sources {
  max-width: 46rem;
  padding-left: 1.25rem;
}

.sources li + li {
  margin-top: 0.4rem;
}

/* Conformance */

.tally {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
  padding: 0;
  list-style: none;
}

.tally li {
  padding-top: 0.75rem;
  border-top: var(--line) solid var(--ink);
  color: var(--ink-2);
  font-size: 0.95rem;
}

.tally strong {
  display: block;
  color: var(--ink);
  font: 800 2.2rem/1.1 var(--mono);
  letter-spacing: -0.03em;
}

/* Playground */

.pg-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0 1rem;
}

.pg-bar label {
  font-weight: 600;
}

select {
  padding: 0.45rem 0.6rem;
  border: var(--line) solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
}

#pg-download {
  margin-left: auto;
}

.pg-panes {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.25rem;
}

#pg-source {
  width: 100%;
  min-height: 24rem;
  padding: 1rem;
  border: var(--line) solid var(--ink);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  font: 0.88rem/1.55 var(--mono);
  resize: vertical;
}

.pg-out {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

.pg-status {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.92rem;
}

.pg-status.error {
  color: var(--ink);
  font-weight: 600;
}

.pg-warnings {
  margin: 0;
  padding: 0;
  list-style: none;
  font: 0.85rem/1.5 var(--mono);
}

.pg-warnings li {
  padding: 0.35rem 0.6rem;
  border-left: 3px solid var(--ink);
  background: var(--note);
}

.pg-warnings li + li {
  margin-top: 0.35rem;
}

.pg-out .sheet-paper {
  flex: 1;
  min-height: 12rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: auto;
}

.pg-out img {
  max-width: 100%;
  width: auto;
}

/* Without JavaScript, the <noscript> message replaces the start hint. */
@media (scripting: none) {
  #pg-start {
    display: none;
  }
}

/* Narrow screens */

@media (max-width: 52rem) {
  .sheet-panes,
  .pg-panes {
    grid-template-columns: minmax(0, 1fr);
  }

  .sheet-wide .sheet-source {
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

  .ways {
    grid-template-columns: minmax(0, 1fr);
  }

  .tally {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #pg-source {
    min-height: 14rem;
  }
}
