@font-face {
  font-family: "Gabarito";
  src: url("fonts/Gabarito.woff2") format("woff2");
  font-weight: 400 900;
  font-display: block;
}
@font-face {
  font-family: "Departure Mono";
  src: url("fonts/DepartureMono-Regular.woff2") format("woff2");
  font-display: block;
}

:root {
  /* Light is the default; dark is opt-in with data-theme="dark". */
  color-scheme: light;

  --page: light-dark(#f2f7f5, #0a1517);
  --surface: light-dark(#ffffff, #0f2226);
  --line: light-dark(#d3e0dd, #1e3b41);
  --text: light-dark(#0a1517, #e8f1ef);
  --text-2: light-dark(#566b6c, #8fa8a8);

  --duck: #ffd43b;
  --duck-shade: #e3a81c;
  --bill: #ff8f3f;
  --ink: #0a1517;
  --egg: light-dark(#a9d3d3, #bfe2e2);
  --water: light-dark(#0d7d92, #4cb8cc);
  --moss: light-dark(#1c8a57, #5ccb8f);
  --moss-shade: light-dark(#14633f, #2f7f57);
  --grass: light-dark(#49b37f, #9be6bf);
  --berry: light-dark(#d4315a, #ff6480);

  --sans: "Gabarito", system-ui, sans-serif;
  --mono: "Departure Mono", ui-monospace, monospace;

  /* Departure Mono is a pixel font: it is only crisp at multiples of 5.5px. */
  --mono-s: 11px;
  --mono-m: 16.5px;
  --mono-l: 22px;

  --notch: 4px;
  --row: 40px;
}
:root[data-theme="dark"] { color-scheme: dark; }

/* Room for the scrollbar is always kept, so short and long pages line up. */
html { scrollbar-gutter: stable; }

/* Moving between pages cross-fades, and the header stays put. */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 140ms; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 400 15px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--mono); font-size: var(--mono-s); line-height: 1.6; -webkit-font-smoothing: none; }
.muted { color: var(--text-2); }

h1, h2, h3 { margin: 0; }
h1 { font-size: 28px; font-weight: 650; line-height: 1.15; }
h2 { font-size: 20px; font-weight: 600; line-height: 1.2; }
h3 { font-size: 13px; font-weight: 600; color: var(--text-2); }

.wordmark { font: 800 44px/1 var(--sans); letter-spacing: -0.01em; }

/* Corners are cut in one pixel step, like the sprites. */
.button {
  display: inline-flex; align-items: center; gap: 8px;
  height: var(--row); padding: 0 16px; border: 0;
  background: var(--duck); color: var(--ink);
  font: 600 15px/1 var(--sans); cursor: pointer;
  clip-path: polygon(var(--notch) 0, calc(100% - var(--notch)) 0, 100% var(--notch), 100% calc(100% - var(--notch)), calc(100% - var(--notch)) 100%, var(--notch) 100%, 0 calc(100% - var(--notch)), 0 var(--notch));
}
.button:active { translate: 0 1px; }
.link { color: var(--water); font-weight: 500; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }

.field { display: grid; gap: 4px; }
.field label { font-size: 13px; color: var(--text-2); }
.field input {
  width: 100%; box-sizing: border-box; height: var(--row); padding: 0;
  background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  color: var(--text); font-family: var(--mono); font-size: var(--mono-m); outline: none; -webkit-font-smoothing: none;
}
.field input:focus { border-bottom-color: var(--duck); }

.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; align-items: center; gap: 12px; height: var(--row); border-bottom: 1px solid var(--line); }
.rows li > * { flex: none; }
.rows .state { width: 84px; }
.rows .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.rows .where { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--mono-s); }
/* Destinations: every column has a set width, so the rows line up whatever they hold. */
.rows.destinations li { display: grid; grid-template-columns: 140px minmax(0, 1fr) 150px 84px 62px; column-gap: 16px; }
.rows.destinations .where, .rows.destinations form { justify-self: end; }
.rows li:first-child { border-top: 1px solid var(--line); }
.rows .state { font-size: 13px; font-weight: 500; }
.rows .text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rows .text b { font-weight: 600; }
.state.waiting { color: var(--text-2); }
.state.moving { color: var(--water); }
.state.delivered { color: var(--moss); }
.state.failed { color: var(--berry); }
.state.done { color: var(--text-2); }

.duck { display: inline-block; vertical-align: middle; image-rendering: pixelated; flex: none; }
.chain { display: inline-flex; align-items: flex-end; gap: 3px; }

/* App pages */
.page { max-width: 880px; margin: 0 auto; padding: 56px 24px 160px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; justify-items: start; }
.page > * { margin: 0; }
.page > section { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; width: 100%; margin-top: 24px; }
.page section p { margin: 0; }
.page form { margin: 0; }
a.button { text-decoration: none; }
.actions { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.inline { display: flex; align-items: flex-end; gap: 12px; }
.inline input { flex: 1; min-width: 0; }

.top { display: flex; align-items: center; gap: 28px; width: 100%; flex-wrap: wrap; min-height: 32px; view-transition-name: top; }
.top nav { display: flex; gap: 20px; flex: 1; }
.top nav a { color: var(--text-2); text-decoration: none; font-weight: 500; }
.top nav a:hover, .top nav a[aria-current] { color: var(--text); }
.account { display: flex; align-items: center; gap: 8px; }
.link.danger { color: var(--berry); }
/* Cut corners, like the button. */
.avatar { display: block; clip-path: polygon(3px 0, calc(100% - 3px) 0, 100% 3px, 100% calc(100% - 3px), calc(100% - 3px) 100%, 3px 100%, 0 calc(100% - 3px), 0 3px); }
.stack { display: grid; gap: 16px; max-width: 560px; }
.field input:not(.inline input) { width: 100%; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 800; font-size: 20px; }

.secret.mono { font-size: var(--mono-m); line-height: var(--row); user-select: all; overflow-wrap: anywhere; }
pre.mono { margin: 0; padding: 14px 16px; background: var(--surface); overflow-x: auto; white-space: pre; }
.prompt { padding: 16px 20px; background: var(--surface); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.snippet { position: relative; }
.snippet pre.mono { white-space: pre-wrap; overflow-wrap: anywhere; padding-right: 76px; }
.snippet .copy { position: absolute; top: 10px; right: 14px; }
.field > .actions { min-height: var(--row); gap: 16px; }
code.mono { font-size: var(--mono-s); }

.rows .muted { font-weight: 400; }

/* Stats page: a few large figures, a chart of days, and plain tables. */
.figures { display: flex; flex-wrap: wrap; gap: 20px 40px; }
.figures b { display: block; font: 800 32px/1.1 var(--sans); letter-spacing: -0.01em; }
.figures span { font-size: 13px; color: var(--text-2); }
.chart { display: block; width: 100%; height: auto; }
.chart text { font: var(--mono-s) var(--mono); fill: var(--text-2); }
.key::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; background: var(--water); }
.key.joins::before { background: var(--duck); }
.scroll { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; white-space: nowrap; }
.table th { height: 32px; padding: 0 16px 0 0; text-align: left; font-size: 13px; font-weight: 500; color: var(--text-2); border-bottom: 1px solid var(--line); }
.table td { height: var(--row); padding: 0 16px 0 0; border-bottom: 1px solid var(--line); }
.table .num { text-align: right; font-family: var(--mono); font-size: var(--mono-s); -webkit-font-smoothing: none; }
.table th:last-child, .table td:last-child { padding-right: 0; }

/* The family swims along the bottom of the home page. */
.pond { position: fixed; left: 0; right: 0; bottom: 0; height: 72px; overflow: hidden; pointer-events: none; }
.pond::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 18px; background: var(--water); }
/* The negative delay starts them already in view. */
.swimmers { position: absolute; bottom: 12px; left: 0; animation: swim 48s linear -12s infinite; }
.swimmers .chain { gap: 9px; }
@keyframes swim { from { translate: -260px 0; } to { translate: 100vw 0; } }
@media (prefers-reduced-motion: reduce) {
  .swimmers { animation: none; left: 24px; }
}

/* The live pond that pond.js builds in place of that strip. Positions come from the script; the
   look is here. Everything in it is decoration, so it is hidden from screen readers. */
.home { position: relative; z-index: 2; pointer-events: none; }
.home > * { pointer-events: auto; }
.home .wordmark { user-select: none; -webkit-user-select: none; }
.handle { color: var(--water); cursor: pointer; }
.pondlive { position: fixed; z-index: 1; left: 0; right: 0; bottom: 0; height: 52vh; --u: 4px; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.pondlive .back > *, .pondlive .d, .pondlive .sign, .pondlive .post, .pondlive .tally, .pondlive .say, .pondlive .crumb, .pondlive .splash { position: absolute; }
.pondlive svg { display: block; }
.pondlive .water { right: 0; bottom: 0; background: var(--water); }
.pondlive .ripple { height: max(2px, calc(var(--u) / 2)); background: var(--egg); }
.pondlive .ripple:nth-of-type(2n) { animation: drift 2.4s step-end infinite; }
.pondlive .ripple:nth-of-type(3n) { animation: drift 3.2s step-end -1.1s infinite; }
.pondlive .cloud { animation: cloud 150s linear -30s infinite; }
.pondlive .cloud.c2 { animation-duration: 210s; animation-delay: -120s; }
.pondlive .cloud.c3 { animation-duration: 180s; animation-delay: -150s; }
@keyframes cloud { from { translate: -80px 0; } to { translate: 100vw 0; } }

.pondlive .d { left: 0; top: 0; cursor: pointer; }
.pondlive .d.left svg { scale: -1 1; }
.pondlive .d.quacking .quack { visibility: visible; }
.pondlive .d.quacking .body { animation: none; translate: 0 -1px; }
.pondlive .d.shake svg { animation: shake 0.3s step-end; }
.pondlive .d.pop svg { transform-origin: 50% 100%; animation: pop 0.24s step-end; }
.pondlive .d.rare { --duck: #ffffff; --duck-shade: #d3e0dd; }
@keyframes shake { 0% { translate: -2px 0; } 33% { translate: 2px 0; } 66% { translate: -2px 0; } }
@keyframes pop { 0% { transform: scale(0.4); } 50% { transform: scale(0.75); } }

.pondlive .sign { z-index: 9; padding: 2px 8px; background: var(--surface); color: var(--text); cursor: pointer; }
.pondlive .post { z-index: 8; background: var(--moss-shade); }
.pondlive .tally { z-index: 9; color: var(--surface); white-space: nowrap; pointer-events: none; }
.pondlive .say { z-index: 2000; translate: -50% 0; padding: 1px 6px; background: var(--surface); color: var(--text); white-space: nowrap; pointer-events: none; }
.pondlive .crumb { z-index: 9; width: calc(var(--u) * 1.5); height: calc(var(--u) * 1.5); background: var(--duck-shade); pointer-events: none; animation: fall 0.26s ease-in; }
.pondlive .splash { z-index: 9; width: calc(var(--u) * 2); height: var(--u); background: var(--egg); pointer-events: none; animation: splash-east 0.42s step-end forwards; }
.pondlive .splash.west { animation-name: splash-west; }
@keyframes fall { from { translate: 0 -70px; } }
@keyframes splash-east { 0% { translate: 0 0; } 34% { translate: var(--u) calc(var(--u) * -2); } 67% { translate: calc(var(--u) * 2) calc(var(--u) * -1); } }
@keyframes splash-west { 0% { translate: 0 0; } 34% { translate: calc(var(--u) * -1) calc(var(--u) * -2); } 67% { translate: calc(var(--u) * -2) calc(var(--u) * -1); } }

.pondlive .water { cursor: pointer; }
.pondlive .fish, .pondlive .ufo, .pondlive .beam { position: absolute; left: 0; top: 0; pointer-events: none; }
.pondlive .fish.left svg { scale: -1 1; }
.pondlive .ufo { z-index: 1800; }
.pondlive .beam { z-index: 1700; width: calc(var(--u) * 8); background: var(--duck); opacity: 0.35; }
.pondlive.party .d svg { animation: party 0.6s step-end infinite; }
.pondlive.party .d:nth-child(2n) svg { animation-delay: -0.3s; }
@keyframes party { 0% { filter: hue-rotate(90deg); } 25% { filter: hue-rotate(180deg); } 50% { filter: hue-rotate(270deg); } 75% { filter: none; } }

/* Night falls slowly and lifts at once. */
.pondlive.night { --water: #072f38; --egg: #1d4a52; --duck: #b9962a; --duck-shade: #8f6c12; --bill: #a85a26; --moss: #0d3f29; --moss-shade: #08291b; --grass: #175a3c; --berry: #7a1c33; --line: #0f2226; }
:root[data-theme="dark"] body:has(.pondlive) { transition: background-color 1.2s linear, color 1.2s linear; }
.pondlive.night .water { transition: background-color 1.2s linear; }
.pondlive.night rect { transition: fill 1.2s linear; }
.pondlive.stare { --ink: #ff2a2a; }
.pondlive.stare .eye { animation: none; }
.pondlive.stare .body { animation: none; }
.pondlive .whisper { position: absolute; left: 0; right: 0; top: calc(var(--u) * 3); text-align: center; font-size: var(--mono-m); color: var(--text-2); visibility: hidden; pointer-events: none; }
.pondlive.stare .whisper { visibility: visible; }

.pondlive .giant { position: absolute; z-index: 1500; left: 50%; bottom: 0; translate: -50% 105%; transition: translate 1.6s cubic-bezier(0.2, 0.7, 0.2, 1); pointer-events: none; }
.pondlive .giant.up { translate: -50% 30%; }

@media (max-width: 700px) {
  .rows.destinations li { grid-template-columns: minmax(0, 1fr) auto auto; height: auto; padding: 10px 0; row-gap: 4px; }
  .rows.destinations .text { grid-column: 1 / -1; grid-row: 2; white-space: normal; }
  .rows.destinations .where { display: none; }
  .top nav { order: 9; flex-basis: 100%; }
}

/* Tags page: the pond, then the list */
.pondview { display: block; width: 100%; height: auto; }

.tally { display: flex; gap: 16px; font-size: 13px; font-weight: 500; }

.tags { list-style: none; margin: 0; padding: 0; }
.tags li { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; column-gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.tags li:first-child { border-top: 1px solid var(--line); }
.tags .what { display: grid; gap: 4px; min-width: 0; color: inherit; text-decoration: none; }
.tags .text, .tags .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tags .text b { font-weight: 600; }
.tags .sub { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.tags .sub .state { font-weight: 500; }
.tags .asked { overflow: hidden; text-overflow: ellipsis; }
.tags .side { display: flex; align-items: center; gap: 12px; }
time.mono { white-space: nowrap; font-variant-numeric: tabular-nums; }
.tags .what:hover .text { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.thumb { width: 40px; height: 40px; object-fit: cover; }
.avatar.blank { display: grid; place-items: center; width: 32px; height: 32px; background: var(--surface); clip-path: none; }

/* One tag: the thread */
.thread { list-style: none; margin: 0; padding: 0; }
.thread li { display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 14px; padding: 16px; margin: 0 -16px; }
.thread li.tag { background: var(--surface); }
.thread p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.thread .who b { font-weight: 600; }
.thread .who time { margin-left: 6px; }
.thread .media { display: block; max-width: 100%; height: auto; max-height: 360px; width: auto; margin-top: 12px; background: var(--line); }
.thread blockquote { margin: 12px 0 0; padding: 12px 14px; background: var(--page); font-size: 13px; }
.thread li.tag blockquote { background: var(--page); }
.outcome { display: flex; align-items: center; gap: 16px; }
.outcome .state { font-weight: 600; }

@media (max-width: 620px) {
  .tags li { grid-template-columns: 32px minmax(0, 1fr); row-gap: 8px; }
  .tags .side { grid-column: 2; }
  .tags .side .chain { display: none; }
}

/* Duck animation. Everything moves in whole pixels, like the sprites. Nothing moves unless it sits
   inside .alive (the pond, the families, a tag that is on its way). */
.duck { overflow: visible; }
.sprite .f2, .sprite .f3, .sprite .quack { visibility: hidden; }

@keyframes frame-a { 0% { visibility: visible; } 50% { visibility: hidden; } }
@keyframes frame-b { 0% { visibility: hidden; } 50% { visibility: visible; } }
@keyframes third-1 { 0% { visibility: visible; } 34% { visibility: hidden; } }
@keyframes third-2 { 0% { visibility: hidden; } 34% { visibility: visible; } 67% { visibility: hidden; } }
@keyframes third-3 { 0% { visibility: hidden; } 67% { visibility: visible; } }
/* The egg sits still, then rocks: left, right, left. */
@keyframes rock-1 { 0% { visibility: visible; } 82% { visibility: hidden; } 94% { visibility: visible; } }
@keyframes rock-2 { 0% { visibility: hidden; } 82% { visibility: visible; } 86% { visibility: hidden; } 90% { visibility: visible; } 94% { visibility: hidden; } }
@keyframes rock-3 { 0% { visibility: hidden; } 86% { visibility: visible; } 90% { visibility: hidden; } }
@keyframes bob { 0% { translate: 0 0; } 50% { translate: 0 1px; } }
@keyframes blink { 0% { fill: var(--ink); } 94% { fill: var(--duck); } 97% { fill: var(--ink); } }
@keyframes drift { 0% { translate: 0 0; } 50% { translate: 2px 0; } }

.alive .swim .f1, .alive.swim .f1 { animation: frame-a 0.8s step-end infinite; }
.alive .swim .f2, .alive.swim .f2 { animation: frame-b 0.8s step-end infinite; }
.alive .dabble .f1, .alive.dabble .f1 { animation: frame-a 0.5s step-end infinite; }
.alive .dabble .f2, .alive.dabble .f2 { animation: frame-b 0.5s step-end infinite; }
.alive .sleep .f1, .alive.sleep .f1 { animation: third-1 2.7s step-end infinite; }
.alive .sleep .f2, .alive.sleep .f2 { animation: third-2 2.7s step-end infinite; }
.alive .sleep .f3, .alive.sleep .f3 { animation: third-3 2.7s step-end infinite; }
.alive .egg .f1, .alive.egg .f1 { animation: rock-1 3.6s step-end infinite; }
.alive .egg .f2, .alive.egg .f2 { animation: rock-2 3.6s step-end infinite; }
.alive .egg .f3, .alive.egg .f3 { animation: rock-3 3.6s step-end infinite; }

/* Ducks without their own strip of water ride up and down; a family does it as a wave. */
.alive .swim:not(.wet) .body, .chain.alive .body { animation: bob 0.8s step-end infinite; }
.brand .sprite .f1, .brand .sprite .f2 { animation: none; }
.chain.alive > :nth-last-child(2) .body { animation-delay: -0.68s; }
.chain.alive > :nth-last-child(3) .body { animation-delay: -0.56s; }
.chain.alive > :nth-last-child(4) .body { animation-delay: -0.44s; }
.chain.alive > :nth-last-child(5) .body { animation-delay: -0.32s; }
.chain.alive > :nth-last-child(6) .body { animation-delay: -0.2s; }
.chain.alive > :nth-last-child(n + 7) .body { animation-delay: -0.08s; }

.alive .eye, .brand .eye { animation: blink 5.2s step-end infinite; }
.alive :nth-child(2n) .eye { animation-delay: -1.9s; }
.alive :nth-child(3n) .eye { animation-delay: -3.4s; }
.alive :nth-child(5n) .eye { animation-duration: 6.8s; }

/* Point at a duck and it hops and opens its beak. */
.pondview a:hover .body, .pondview a:focus-visible .body, .brand:hover .body, .chain.alive > svg:hover .body { animation: none; translate: 0 -1px; }
.pondview a:hover .quack, .pondview a:focus-visible .quack, .brand:hover .quack, .chain.alive > svg:hover .quack { visibility: visible; }
.pondview a { outline: none; }
.pondview .ripple:nth-of-type(2n) { animation: drift 2.4s step-end infinite; }
.pondview .ripple:nth-of-type(3n) { animation: drift 3.2s step-end -1.1s infinite; }
.pondview .wake .f1 { animation: frame-a 0.8s step-end infinite; }
.pondview .wake .f2 { visibility: hidden; animation: frame-b 0.8s step-end infinite; }
.swimmers .chain > svg { pointer-events: auto; }

@media (prefers-reduced-motion: reduce) {
  .sprite *, .sprite .body, .pondview .ripple, .pondview .wake * { animation: none !important; }
  .pondview .wake .f2 { visibility: hidden; }
}
