/* bunter.gshaw.ca. Plain on purpose, with a little more character than gshaw.ca. */

:root {
  --bg: #f7f5f0;
  --paper: #fffdf8;
  --ink: #1d1c1a;
  --muted: #6b665d;
  --line: #e2ddd2;
  --line-strong: #cfc8ba;
  --accent: #7a2e2e; /* the bow tie: oxblood */
  --good: #2f6b4a;
  --good-bg: #e3efe6;
  --warn: #9a6512;
  --warn-bg: #f6ead2;
  --bad: #a33a2a;
  --hl: #fff1b8;
  --code-bg: #efebe2;
  --shadow: 0 1px 2px rgb(40 30 10 / 6%), 0 8px 24px -12px rgb(40 30 10 / 18%);
  --serif:
    "Iowan Old Style", "Palatino Linotype", Palatino, Charter, "Book Antiqua",
    Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.22, 0.8, 0.24, 1);

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141518;
    --paper: #1c1d21;
    --ink: #e9e6df;
    --muted: #a19b90;
    --line: #2e2f35;
    --line-strong: #43444b;
    --accent: #d98b7c;
    --good: #7cc497;
    --good-bg: #1f3328;
    --warn: #e2b25c;
    --warn-bg: #3a2f1a;
    --bad: #ef8a76;
    --hl: #4a3f14;
    --code-bg: #212227;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 10px 30px -14px rgb(0 0 0 / 70%);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 1.0625rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

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

:not(pre) > code {
  background: var(--code-bg);
  padding: 0.08em 0.35em;
  border-radius: 4px;
}

pre {
  background: var(--code-bg);
  padding: 1rem 1.1rem;
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.5;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.wrap {
  width: min(100% - 2.5rem, 46rem);
  margin-inline: auto;
}

/* Hero */

.hero {
  padding-block: clamp(2.5rem, 8vw, 5rem) 1.5rem;
}

.mark {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 1.25rem;
  font: 600 1.05rem/1 var(--serif);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.bowtie {
  width: 1.9rem;
  height: auto;
  fill: var(--accent);
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.2;
  text-wrap: balance;
}

h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.9rem, 5.5vw, 2.9rem);
  letter-spacing: -0.01em;
}

.lede {
  margin: 0;
  font-size: 1.15rem;
  color: var(--muted);
  text-wrap: pretty;
}

.lede strong {
  color: var(--ink);
  font-weight: 600;
}

/* Prose */

.prose {
  padding-bottom: 2rem;
}

.prose section {
  margin-top: 3.25rem;
}

h2 {
  font-size: 1.6rem;
  margin: 0 0 0.75rem;
}

h3 {
  font-size: 1.3rem;
  margin: 0 0 0.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
}

.prose p,
.prose li {
  text-wrap: pretty;
}

.prose ul {
  padding-left: 1.2rem;
}

.prose li {
  margin-block: 0.55rem;
}

.prose li::marker {
  color: var(--accent);
}

.tool-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.4rem 1.5rem 0.6rem;
  margin-block: 1.1rem;
  box-shadow: var(--shadow);
}

.tool-card p:first-of-type {
  margin-top: 0.25rem;
}

.tool-card pre {
  font-size: 0.8rem;
}

.badge {
  font: 500 0.75rem/1 var(--sans);
  padding: 0.3rem 0.55rem;
  border-radius: 99px;
  white-space: nowrap;
}

.badge.built {
  background: var(--good-bg);
  color: var(--good);
}

.badge.building {
  background: var(--warn-bg);
  color: var(--warn);
}

.foot {
  border-top: 1px solid var(--line);
  padding-block: 1.25rem 3rem;
  color: var(--muted);
  font-size: 0.95rem;
}

/* The show: three scenes. Without JS, or with reduced motion, they stack in
   their final state. With JS they share one cell and play in turn. */

.show {
  margin-block: 1.5rem 0;
  width: min(100% - 1.5rem, 54rem);
}

.stage {
  display: grid;
  gap: 1rem;
}

.scene {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: clamp(1rem, 3vw, 1.75rem);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.stage.animating .scene {
  grid-area: 1 / 1;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition:
    opacity 0.5s var(--ease),
    transform 0.6s var(--ease),
    visibility 0s linear 0.5s;
}

.stage.animating .scene.active {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition:
    opacity 0.6s var(--ease) 0.15s,
    transform 0.7s var(--ease) 0.15s,
    visibility 0s;
}

/* A scene being reset drops its transitions for one frame. */
.scene.instant,
.scene.instant * {
  transition: none !important;
}

.kicker {
  margin: 0;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.6rem;
  font: 600 1.15rem/1.3 var(--serif);
}

.tool {
  font: 600 0.78rem/1 var(--mono);
  color: var(--paper);
  background: var(--ink);
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  letter-spacing: 0.02em;
}

.note {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.ok,
.good {
  color: var(--good);
  font-weight: 700;
}

.bad {
  color: var(--bad);
  font-weight: 700;
}

/* Windows */

.win {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg);
  overflow: hidden;
  min-width: 0;
}

.win-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.75rem;
  font: 500 0.78rem/1.2 var(--sans);
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.dots {
  width: 2.1rem;
  height: 0.55rem;
  flex: none;
  background:
    radial-gradient(
      circle at 0.275rem 50%,
      var(--line-strong) 0.24rem,
      transparent 0.26rem
    ),
    radial-gradient(
      circle at 1.05rem 50%,
      var(--line-strong) 0.24rem,
      transparent 0.26rem
    ),
    radial-gradient(
      circle at 1.825rem 50%,
      var(--line-strong) 0.24rem,
      transparent 0.26rem
    );
}

.win-body {
  padding: 0.85rem 1rem;
}

.mono {
  font: 0.82rem/1.65 var(--mono);
}

/* Generic entrance: anything with data-steps="…:in" fades up into place. */
.stage.animating [data-steps*=":in"]:not(.in) {
  opacity: 0;
  transform: translateY(6px);
}

.stage.animating [data-steps*=":in"] {
  transition:
    opacity 0.55s var(--ease),
    transform 0.6s var(--ease),
    background-color 0.5s var(--ease),
    color 0.5s var(--ease);
}

/* Scene 1: am */

.s1 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 4.5rem minmax(0, 1.15fr);
  align-items: center;
  gap: 0.5rem;
}

.mail .win-body {
  position: relative;
}

.mail p {
  margin: 0;
}

.mail-from {
  font-size: 0.78rem;
  color: var(--muted);
}

.mail-subj {
  font: 600 1rem/1.35 var(--serif);
  margin-block: 0.2rem 0.35rem !important;
}

.mail-text {
  font-size: 0.85rem;
  color: var(--muted);
}

.stage.animating .mail:not(.in) {
  transform: translateX(-24px);
}

.stamp {
  display: inline-block;
  margin-top: 0.7rem;
  font: 600 0.7rem/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  border: 1.5px solid currentcolor;
  border-radius: 5px;
  padding: 0.3rem 0.45rem;
  transform: rotate(-4deg);
  transition:
    opacity 0.35s var(--ease),
    transform 0.45s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.stage.animating .mail:not(.fwd) .stamp {
  opacity: 0;
  transform: rotate(-4deg) scale(1.5);
}

.arrow {
  width: 100%;
  height: auto;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.arrow path {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.8s var(--ease);
}

.arrow path + path {
  transition-delay: 0.55s;
  transition-duration: 0.35s;
}

.stage.animating .arrow:not(.in) {
  transform: none;
}

.stage.animating .arrow:not(.in) path {
  stroke-dashoffset: 1;
}

.tree,
.tree ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tree ul {
  padding-left: 1.1rem;
  border-left: 1px solid var(--line-strong);
  margin-left: 0.3rem;
}

.tree li {
  padding-left: 0.3rem;
}

.dir {
  font-weight: 600;
}

.empty {
  font-size: 0.72rem;
  color: var(--good);
  margin-left: 0.4rem;
}

/* The inbox row: appears highlighted, then is filed away and collapses. */
.row-new {
  display: grid;
  grid-template-rows: 1fr;
  transition:
    grid-template-rows 0.6s var(--ease),
    opacity 0.45s var(--ease) !important;
}

.row-new > span {
  overflow: hidden;
  background: var(--hl);
  border-radius: 4px;
  padding-inline: 0.25rem;
  margin-left: -0.25rem;
}

.row-new.out {
  grid-template-rows: 0fr;
  opacity: 0;
}

.target {
  border-radius: 4px;
  margin-left: -0.25rem;
  padding-left: 0.55rem !important;
}

.target {
  transition: background-color 0.5s var(--ease);
}

.target.hit {
  background: var(--hl);
}

.diff {
  margin: 0.6rem 0 0;
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  background: var(--good-bg);
  color: var(--good);
  font-size: 0.76rem;
  overflow: hidden;
}

.diff span {
  display: block;
  clip-path: inset(0 0 0 0);
  transition: clip-path 1.1s steps(28, end) 0.25s;
}

.stage.animating .diff:not(.in) span {
  clip-path: inset(0 100% 0 0);
}

/* Scene 2: Rota */

.clock {
  margin-left: auto;
  position: relative;
  display: inline-grid;
  font: 600 0.85rem/1 var(--mono);
  color: var(--ink);
  overflow: hidden;
  padding: 0.15rem 0;
}

.clock span {
  grid-area: 1 / 1;
  transition:
    transform 0.55s var(--ease),
    opacity 0.4s var(--ease);
}

.clock .t-old {
  transform: translateY(-110%);
  opacity: 0;
}

.stage.animating .clock:not(.tick) .t-old {
  transform: none;
  opacity: 1;
}

.stage.animating .clock:not(.tick) .t-new {
  transform: translateY(110%);
  opacity: 0;
}

.task {
  display: grid;
  grid-template-columns: 0.6rem 8.5rem 8.5rem minmax(0, 1fr);
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.55rem 0.5rem;
  border-radius: 8px;
  transition:
    opacity 0.7s var(--ease),
    background-color 0.6s var(--ease),
    filter 0.7s var(--ease);
}

.task + .task {
  margin-top: 0.15rem;
}

.task .dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--line-strong);
  align-self: center;
  transition:
    background-color 0.4s var(--ease),
    box-shadow 0.4s var(--ease);
}

.task .name {
  font-weight: 600;
}

.task .sched {
  color: var(--muted);
}

.status {
  display: grid;
}

.status > span {
  grid-area: 1 / 1;
  transition:
    opacity 0.4s var(--ease),
    transform 0.5s var(--ease);
}

/* Final state by default; the animation walks backwards from it. */
.st-next,
.st-run {
  opacity: 0;
  transform: translateY(-6px);
}

.idle .st-next {
  opacity: 1;
  transform: none;
  color: var(--muted);
}

.stage.animating .task:not(.run) .st-next {
  opacity: 1;
  transform: none;
  color: var(--muted);
}

.stage.animating .task:not(.run) .st-run,
.stage.animating .task:not(.run) .st-done,
.stage.animating .task.run:not(.done) .st-done {
  opacity: 0;
  transform: translateY(6px);
}

.stage.animating .task.run:not(.done) .st-run {
  opacity: 1;
  transform: none;
  color: var(--ink);
}

.stage.animating .task.run:not(.done) .dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}

.spin {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  margin-right: 0.45rem;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  vertical-align: -0.05rem;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.v-settled {
  color: var(--good);
}

.v-review {
  color: var(--warn);
}

.task.settle .dot {
  background: var(--good);
}

.task.settle {
  opacity: 0.45;
}

.task.stay {
  background: var(--warn-bg);
}

.task.stay .dot {
  background: var(--warn);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn) 25%, transparent);
}

/* Scene 3: stet */

.term .win-body {
  background: #17181b;
  color: #e6e3dc;
  min-height: 15.5rem;
}

.term .win-body p {
  margin: 0;
}

.term .good {
  color: #7cc497;
}

.term .bad {
  color: #ef8a76;
}

.term .sub {
  padding-left: 2ch;
  color: #a7a196;
}

.term .comment {
  color: #8d877c;
  font-style: italic;
  margin-block: 0.35rem !important;
}

.cmd {
  color: #f1d58c;
}

.cmd + .cmd,
.out + .cmd {
  margin-top: 0.5rem !important;
}

.cmd span {
  display: inline-block;
  clip-path: inset(0 0 0 0);
  transition: clip-path 0.6s steps(12, end);
}

.stage.animating .cmd:not(.in) span {
  clip-path: inset(0 100% 0 0);
}

/* Controls */

.controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.controls[hidden] {
  display: none;
}

.controls button {
  font: 500 0.85rem/1 var(--sans);
  color: var(--ink);
  background: transparent;
  border: 0;
  padding: 0.4rem 0.3rem;
  cursor: pointer;
}

.pause {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex: none;
  min-width: 5.2rem;
}

.i-pause {
  width: 0.7rem;
  height: 0.75rem;
  border-inline: 0.22rem solid currentcolor;
}

.pause[aria-pressed="true"] .i-pause {
  border: 0;
  border-left: 0.65rem solid currentcolor;
  border-block: 0.38rem solid transparent;
  height: 0;
}

.chapters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  flex: 1;
}

.chapter {
  display: grid;
  gap: 0.4rem;
  text-align: left;
  font-family: var(--mono) !important;
  color: var(--muted) !important;
}

.chapter.current {
  color: var(--ink) !important;
}

.bar {
  height: 3px;
  border-radius: 3px;
  background: var(--line-strong);
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  transform-origin: left;
  transform: scaleX(0);
}

/* Phone */

@media (width < 40rem) {
  body {
    font-size: 1rem;
  }

  .s1 {
    grid-template-columns: minmax(0, 1fr);
    justify-items: stretch;
  }

  .arrow {
    width: 2.6rem;
    justify-self: center;
    transform: rotate(90deg);
  }

  .stage.animating .arrow:not(.in) {
    transform: rotate(90deg);
  }

  .task {
    grid-template-columns: 0.6rem minmax(0, 1fr) auto;
    row-gap: 0.15rem;
  }

  .task .status {
    grid-column: 2 / -1;
  }

  .mono {
    font-size: 0.76rem;
  }

  .tool-card {
    padding-inline: 1.1rem;
  }
}

/* The scenes share one cell, so the tallest sets the height. The windows in
   the shorter ones stretch to fill it rather than leave a gap at the bottom. */
.stage.animating .rota,
.stage.animating .term {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.stage.animating .rota .win-body,
.stage.animating .term .win-body {
  flex: 1;
}

@media (width < 40rem) {
  .mail-text {
    display: none;
  }

  .stamp {
    margin-top: 0.5rem;
  }
}
