/* A paste is a slip of thermal paper: cool white paper, blue-black print, and
   the pink stripe that shows when a paper roll is at its end. */

:root {
  /* Each color has a light and a dark value. The theme switch sets
     color-scheme, and light-dark() then selects the value. */
  color-scheme: light dark;

  --desk: light-dark(#e6e7ec, #0e0f13);
  --paper: light-dark(#fdfdfb, #1c1e27);
  --ink: light-dark(#1b1e2a, #eceef4);
  --ink-soft: light-dark(#595e70, #a4a9ba);
  --rule: light-dark(#c9ccd6, #3a3e4d);
  --stripe: light-dark(#e2306c, #ff5e90);
  --term: light-dark(#1b1e2a, #07080a);
  --term-ink: #eceef4;
  --term-soft: #9ba1b4;
  --code-keyword: light-dark(#2747c7, #93a9ff);
  --code-string: light-dark(#0b7558, #6fd6b3);
  --code-number: light-dark(#b0205f, #ff8db3);
  --shadow: light-dark(#0f121e, #000);

  --mono: ui-monospace, "SF Mono", SFMono-Regular, "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --tooth: 9px;
  --gutter: 24px;
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

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

* {
  margin: 0;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  padding: 0 20px;
  background: var(--desk);
  color: var(--ink);
  font: 1rem/1.55 var(--sans);
  -webkit-text-size-adjust: 100%;
}

.site-header,
main,
.site-footer {
  max-width: 760px;
  margin-inline: auto;
}

a {
  color: inherit;
  text-underline-offset: 3px;
}

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

h1,
h2,
h3 {
  font-family: var(--mono);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

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

/* Header and footer */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 24px;
  padding: 26px 0;
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  margin-left: auto;
  font: 0.85rem var(--mono);
}

.site-header nav a {
  color: var(--ink-soft);
  text-decoration: none;
}

.site-header nav a:hover,
.site-header nav a[aria-current] {
  color: var(--ink);
}

.site-header nav a[aria-current] {
  text-decoration: underline;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 700 1.05rem var(--mono);
  letter-spacing: -0.02em;
  text-decoration: none;
}

.site-footer a {
  color: var(--ink-soft);
}

.site-footer a:hover {
  color: var(--ink);
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px 32px;
  padding: 56px 0 40px;
  color: var(--ink-soft);
  font: 0.8rem var(--mono);
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
}

/* Home */

.intro {
  padding: 30px 0 34px;
}

.intro h1 {
  font-size: clamp(1.9rem, 6vw, 2.75rem);
  letter-spacing: -0.05em;
  line-height: 1.05;
}

.intro p {
  max-width: 34em;
  margin-top: 16px;
  color: var(--ink-soft);
  font-size: 1.06rem;
}

/* The slip */

.slip-wrap {
  /* A mask removes a box-shadow, so the shadow comes from a filter on the parent. */
  filter: drop-shadow(0 1px 1px color-mix(in srgb, var(--shadow) 12%, transparent))
    drop-shadow(0 16px 28px color-mix(in srgb, var(--shadow) 10%, transparent));
}

.slip {
  position: relative;
  padding-bottom: calc(var(--tooth) + 6px);
  border-radius: 5px 5px 0 0;
  background: var(--paper);
  /* Cuts the bottom edge into teeth, like paper that was torn from a roll. */
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / calc(2 * var(--tooth)) 100%;
  mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / calc(2 * var(--tooth)) 100%;
}

.slip > * + * {
  border-top: 1px dashed var(--rule);
}

/* The end-of-roll stripe: this paste is the last one, or its time is almost over. */
.slip.is-last::before,
.slip.is-last::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 5px;
  background: var(--stripe);
}

.slip.is-last::before {
  left: 0;
}

.slip.is-last::after {
  right: 0;
}

.slip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  min-height: 50px;
  padding: 10px var(--gutter);
  color: var(--ink-soft);
  font: 0.8rem/1.5 var(--mono);
}

.slip-body {
  padding: 36px var(--gutter) 40px;
}

.slip-body h1 {
  font-size: 1.5rem;
}

.slip-body p {
  max-width: 34em;
  margin: 12px 0 24px;
  color: var(--ink-soft);
}

.note {
  color: var(--ink-soft);
  font: 0.85rem/1.5 var(--sans);
}

.error {
  color: var(--stripe);
  font-weight: 600;
}

textarea {
  display: block;
  width: 100%;
  min-height: 300px;
  padding: 20px var(--gutter);
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: 0.9rem/1.6 var(--mono);
  resize: vertical;
  tab-size: 4;
}

textarea::placeholder {
  color: var(--ink-soft);
}

textarea:focus-visible {
  outline: none;
  box-shadow: inset 3px 0 0 var(--ink);
}

/* Controls */

.button {
  display: inline-block;
  padding: 10px 18px;
  border: 0;
  border-radius: 4px;
  background: var(--ink);
  color: var(--paper);
  font: 600 0.9rem/1.3 var(--mono);
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  opacity: 0.85;
}

.button:disabled {
  opacity: 0.5;
  cursor: progress;
}

.button-small {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.text-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.controls .button {
  margin-left: auto;
}

.choice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.choice > span {
  margin-right: 6px;
}

.choice input {
  position: absolute;
  opacity: 0;
}

.choice label span {
  display: block;
  padding: 5px 10px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  color: var(--ink);
  cursor: pointer;
}

.choice input:checked + span {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.choice input:focus-visible + span {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  cursor: pointer;
}

.check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--ink);
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 24px var(--gutter);
}

.link-row input {
  flex: 1 1 260px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  font: 0.85rem var(--mono);
}

/* Terminal */

.terminal,
.reply {
  margin-top: 64px;
}

.terminal h2,
.reply h2 {
  font-size: 1.2rem;
}

.terminal > p,
.reply > p {
  max-width: 34em;
  margin-top: 8px;
  color: var(--ink-soft);
}

.reply .button {
  margin-top: 20px;
}

.term {
  overflow-x: auto;
  margin: 20px 0 12px;
  padding: 18px 20px;
  border-radius: 8px;
  background: var(--term);
  color: var(--term-ink);
  font-size: 0.85rem;
  line-height: 1.8;
}

.term .prompt {
  color: var(--stripe);
  user-select: none;
}

.term .reply {
  color: var(--term-soft);
}

/* A command block with its copy button. site.js adds the frame and the button.
   The button is next to the text, not on top of it, so that a long command
   scrolls without going below the button. */

.code {
  display: flex;
  align-items: flex-start;
  border-radius: 6px;
  background: var(--term);
}

.code > pre {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.copy-icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 30px;
  height: 30px;
  margin: 8px 8px 0 0;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: none;
  color: var(--term-soft);
  font: 0.72rem var(--mono);
  cursor: pointer;
}

/* The status text exists only while there is a status. An empty box here
   would add the gap and push the icon away from the center. */
.copy-icon[data-status]::before {
  content: attr(data-status);
}

.copy-icon:hover,
.copy-icon[data-status] {
  border-color: var(--term-soft);
  color: var(--term-ink);
}

.copy-icon:focus-visible {
  outline-color: var(--term-ink);
  outline-offset: -2px;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 28px 32px;
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
}

.facts h3 {
  font-size: 0.92rem;
  letter-spacing: -0.02em;
}

.facts p {
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

/* Paste content */

#content {
  overflow-x: auto;
  padding: 22px var(--gutter);
  color: var(--ink);
  font-size: 0.86rem;
  line-height: 1.65;
  tab-size: 4;
}

noscript .note {
  margin-top: 16px;
}

.hljs-comment,
.hljs-quote,
.hljs-meta {
  color: var(--ink-soft);
  font-style: italic;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-built_in,
.hljs-type,
.hljs-attr,
.hljs-attribute {
  color: var(--code-keyword);
}

.hljs-string,
.hljs-regexp,
.hljs-addition,
.hljs-template-variable {
  color: var(--code-string);
}

.hljs-number,
.hljs-symbol,
.hljs-variable,
.hljs-deletion,
.hljs-link {
  color: var(--code-number);
}

.hljs-title,
.hljs-section,
.hljs-name,
.hljs-selector-id,
.hljs-selector-class {
  font-weight: 700;
}

.hljs-emphasis {
  font-style: italic;
}

.hljs-strong {
  font-weight: 700;
}

/* About and privacy */

.prose {
  padding: 40px clamp(var(--gutter), 6vw, 52px) calc(var(--tooth) + 44px);
}

.prose > * + * {
  border-top: 0;
}

.prose h1 {
  font-size: 1.75rem;
}

.prose h2 {
  margin-top: 40px;
  font-size: 1.05rem;
}

.prose p,
.prose ul,
.prose ol,
.prose pre,
.prose .code {
  margin-top: 14px;
}

.prose .code > pre {
  margin-top: 0;
}

.terminal .code {
  margin: 20px 0 12px;
  border-radius: 8px;
}

.prose ul,
.prose ol {
  padding-left: 22px;
}

.prose li + li {
  margin-top: 8px;
}

.prose .updated {
  margin-top: 8px;
  color: var(--ink-soft);
  font: 0.8rem var(--mono);
}

.prose code {
  font-size: 0.88em;
}

.prose :not(pre) > code {
  padding: 1px 5px;
  border: 1px solid var(--rule);
  border-radius: 3px;
}

.prose pre {
  overflow-x: auto;
  padding: 14px 16px;
  border-radius: 6px;
  background: var(--term);
  color: var(--term-ink);
  line-height: 1.7;
}

@media (max-width: 560px) {
  :root {
    --gutter: 18px;
  }

  body {
    padding: 0 14px;
  }

  textarea {
    min-height: 220px;
  }

  .controls .button {
    width: 100%;
  }

  /* The page links go below the name and the "New paste" button. */
  .site-header nav {
    order: 1;
    width: 100%;
    margin-left: 0;
  }

  .site-header .button {
    margin-left: auto;
  }
}
