:root {
  --font-sans: "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-pixel: "Silkscreen", ui-monospace, monospace;
  --hatch-gap: 8px;
}

:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0c0c0b;
  --paper-2: #151514;
  --ink: #efede9;
  --ink-hover: #ffffff;
  --ink-2: #6f6d69;
  --muted: #9b9893;
  --line: #393835;
  --line-soft: #2c2b29;
  --plus: rgba(239, 237, 233, 0.07);
  --land-ink: #85827c;
  --app-1: #f5b83d;
  --app-2: #4fd18b;
  --app-3: #52b6f5;
  --app-4: #b08cfa;
  --app-5: #f7797d;
}

:root[data-theme="light"] {
  color-scheme: light;
  --paper: #f1efeb;
  --paper-2: #e8e5e0;
  --ink: #161616;
  --ink-hover: #2e2e2e;
  --ink-2: #9a9792;
  --muted: #6a6762;
  --line: #2e2e2e;
  --line-soft: #c9c5bf;
  --plus: rgba(22, 22, 22, 0.1);
  --land-ink: #161616;
  --app-1: #a35f00;
  --app-2: #17803f;
  --app-3: #0a67a3;
  --app-4: #6a3fd1;
  --app-5: #c0283c;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.sprite,
[hidden] {
  display: none !important;
}

.brand-icon {
  width: 16px;
  height: 16px;
  flex: none;
  fill: currentColor;
}

canvas {
  display: block;
  image-rendering: pixelated;
}

.label {
  font: 400 14px/1 var(--font-pixel);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

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

/* ---------- the frame: everything sits inside ruled lines ---------- */

.frame {
  width: min(1240px, 100% - 32px);
  margin: 16px auto;
  border: 1px solid var(--line);
}

.hatch {
  height: 32px;
  border-block: 1px solid var(--line);
  background: repeating-linear-gradient(-45deg, var(--line) 0 1px, transparent 1px var(--hatch-gap));
}

/* ---------- buttons ---------- */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 44px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 0;
  background: none;
  color: inherit;
  font: 500 15px/1 var(--font-sans);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, transform 0.1s;
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 3px;
}

.btn-solid {
  background: var(--ink);
  color: var(--paper);
}

.btn-solid:hover {
  background: var(--ink-hover);
}

/* outline buttons carry small corner brackets, like crop marks */
.btn-outline {
  border-color: var(--line-soft);
  color: var(--ink);
}

.btn-outline::before {
  content: "";
  position: absolute;
  inset: -1px;
  --c: var(--ink);
  background:
    linear-gradient(var(--c), var(--c)) 0 0 / 7px 1px,
    linear-gradient(var(--c), var(--c)) 0 0 / 1px 7px,
    linear-gradient(var(--c), var(--c)) 100% 0 / 7px 1px,
    linear-gradient(var(--c), var(--c)) 100% 0 / 1px 7px,
    linear-gradient(var(--c), var(--c)) 0 100% / 7px 1px,
    linear-gradient(var(--c), var(--c)) 0 100% / 1px 7px,
    linear-gradient(var(--c), var(--c)) 100% 100% / 7px 1px,
    linear-gradient(var(--c), var(--c)) 100% 100% / 1px 7px;
  background-repeat: no-repeat;
  pointer-events: none;
}

.btn-outline:hover {
  background: var(--paper-2);
}

.btn-square {
  width: 44px;
  padding: 0;
}

.px-icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
  shape-rendering: crispEdges;
}

.icon-moon,
:root[data-theme="light"] .icon-sun {
  display: none;
}

:root[data-theme="light"] .icon-moon {
  display: block;
}

/* ---------- top bar ---------- */

.bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 14px 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-self: start;
  color: var(--ink);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
}

/* the wolf is an alpha mask, so it prints in the theme's ink with no background of its own */
.logo-mark {
  width: 56px;
  aspect-ratio: 400 / 361;
  flex: none;
  background: currentColor;
  -webkit-mask: url("assets/logo/wolf-mask.webp") center / contain no-repeat;
  mask: url("assets/logo/wolf-mask.webp") center / contain no-repeat;
}

.brand-name {
  font: 600 22px/1 var(--font-sans);
  letter-spacing: -0.03em;
}

.brand-name span {
  color: var(--muted);
  font-weight: 500;
}

.footer-center .logo-mark {
  width: 104px;
}

.nav {
  display: flex;
  gap: 28px;
}

.nav a {
  color: var(--muted);
  font-size: 15px;
  text-decoration: none;
  transition: color 0.15s;
}

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

.bar-actions {
  display: flex;
  gap: 10px;
  justify-self: end;
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
}

.plus-field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  stroke: var(--plus);
  stroke-width: 1;
  -webkit-mask-image: linear-gradient(to bottom, transparent 10%, #000 60%);
  mask-image: linear-gradient(to bottom, transparent 10%, #000 60%);
  pointer-events: none;
}

.hero-copy {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 104px 24px 0;
  text-align: center;
}

.hero h1 {
  display: flex;
  flex-direction: column;
  font-size: clamp(38px, 6.2vw, 76px);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.035em;
}

.hero h1 span {
  text-wrap: balance;
}

.hero h1 .dim {
  color: var(--ink-2);
}

.sub {
  max-width: 44ch;
  margin-top: 20px;
  color: var(--muted);
  font-size: 17px;
}

.cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 32px;
}

.landscape {
  position: relative;
  width: 100%;
  height: 330px;
  margin-top: 64px;
  color: var(--land-ink);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}

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

/* ---------- readme: two layouts behind one switch ---------- */

.view-switch {
  display: flex;
  border: 1px solid var(--line-soft);
}

.view-switch button {
  padding: 8px 14px;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.view-switch button + button {
  border-left: 1px solid var(--line-soft);
}

.view-switch button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}

/* ---------- readme as a chat: the knight types to you ---------- */

.readme-chat {
  display: grid;
  grid-template-columns: 1fr 2fr;
}

.chat-avatar {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px 24px;
  border-right: 1px solid var(--line);
}

.chat-avatar .mascot {
  margin: 0 auto 8px;
}

.chat-who {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.chat-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-status i {
  width: 8px;
  height: 8px;
  background: var(--ink);
}

.readme-chat.typing .chat-status i {
  animation: blink 0.6s steps(1) infinite;
}

.chat-window {
  display: flex;
  flex-direction: column;
  margin: 24px;
  border: 1px solid var(--line);
}

.thread {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 24px;
}

.msg {
  position: relative;
  max-width: min(580px, 100%);
  padding: 12px 16px;
  border: 1px solid var(--line-soft);
  background: var(--paper-2);
  font: 400 14.5px/1.65 "JetBrains Mono", ui-monospace, Menlo, monospace;
  animation: msg-in 0.18s ease-out;
}

/* the same crop-mark corners as the outline buttons */
.msg::before {
  content: "";
  position: absolute;
  inset: -1px;
  --c: var(--ink);
  background:
    linear-gradient(var(--c), var(--c)) 0 0 / 7px 1px,
    linear-gradient(var(--c), var(--c)) 0 0 / 1px 7px,
    linear-gradient(var(--c), var(--c)) 100% 100% / 7px 1px,
    linear-gradient(var(--c), var(--c)) 100% 100% / 1px 7px;
  background-repeat: no-repeat;
  pointer-events: none;
}

.msg-typing {
  display: flex;
  gap: 5px;
  padding: 16px;
}

.msg-typing i {
  width: 6px;
  height: 6px;
  background: var(--muted);
  animation: typing-dot 0.9s steps(1) infinite;
}

.msg-typing i:nth-child(2) { animation-delay: 0.15s; }
.msg-typing i:nth-child(3) { animation-delay: 0.3s; }

.msg .chips {
  margin-top: 10px;
}

.msg .chips li {
  animation: msg-in 0.15s ease-out;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
}

@keyframes typing-dot {
  0%, 66% { opacity: 0.25; }
  33% { opacity: 1; }
}

/* ---------- readme as code: a file that types itself ---------- */

.readme-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
}

.editor {
  display: flex;
  flex-direction: column;
  margin: 24px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.editor-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 42px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
}

.editor-dots {
  display: flex;
  gap: 6px;
}

.editor-dots i {
  width: 10px;
  height: 10px;
  border: 1px solid var(--ink-2);
}

.editor-dots i:first-child {
  background: var(--ink-2);
}

.editor-replay {
  justify-self: end;
  padding: 6px 8px;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s;
}

.editor-replay:hover {
  color: var(--ink);
}

.code {
  flex: 1;
  padding: 18px 0 22px;
  font: 400 14.5px/1.8 "JetBrains Mono", ui-monospace, Menlo, monospace;
  cursor: text;
}

.code-line {
  display: grid;
  grid-template-columns: 52px 1fr;
  min-height: 1.8em;
}

.code-line .ln {
  padding-right: 18px;
  color: var(--ink-2);
  text-align: right;
  opacity: 0;
  user-select: none;
}

.code-line.on .ln {
  opacity: 1;
}

.code-line .src {
  padding-right: 20px;
  white-space: pre;
}

.tok-com { color: var(--ink-2); font-style: italic; }
.tok-kw { color: var(--ink); font-weight: 600; }
.tok-key { color: var(--muted); }
.tok-str { color: var(--ink); }
.tok-lit { color: var(--ink); text-decoration: underline dotted var(--ink-2); text-underline-offset: 4px; }
.tok-punc { color: var(--ink-2); }

.caret {
  display: inline-block;
  width: 0.62em;
  height: 1.15em;
  margin-left: 1px;
  vertical-align: -0.2em;
  background: var(--ink);
}

.code.done .caret {
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.id-card {
  display: flex;
  flex-direction: column;
  padding: 24px;
  border-left: 1px solid var(--line);
}

/* the knight in ink: two 3×3 sheets used as masks, so the lines take the theme's ink colour */
.mascot {
  position: relative;
  display: block;
  width: 280px;
  height: 280px;
  margin: 24px auto;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}

.mascot-squash {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: 50% 78%;
}

.mascot-layer {
  position: absolute;
  inset: 0;
  background: currentColor;
  -webkit-mask-size: 300% 300%;
  mask-size: 300% 300%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

.mascot-dir {
  -webkit-mask-image: url("assets/mascot/knight-ink-directions.webp");
  mask-image: url("assets/mascot/knight-ink-directions.webp");
}

.mascot-react {
  -webkit-mask-image: url("assets/mascot/knight-ink-reactions.webp");
  mask-image: url("assets/mascot/knight-ink-reactions.webp");
  opacity: 0;
}

.mascot.reacting .mascot-dir {
  opacity: 0;
}

.mascot.reacting .mascot-react {
  opacity: 1;
}

.id-card .mascot {
  margin: auto;   /* centred in whatever height the editor gives the card */
}

.id-spec {
  margin-top: 24px;
  border-top: 1px solid var(--line);
}

.id-spec > div {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 12px;
  align-items: baseline;
  padding: 14px 0;
}

.id-spec > div + div {
  border-top: 1px solid var(--line-soft);
}

.id-spec dt {
  color: var(--muted);
}

.id-spec dd {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chips li {
  padding: 6px 8px;
  border: 1px solid var(--line-soft);
  font: 400 12px/1 var(--font-pixel);
  text-transform: uppercase;
}

/* ---------- services ---------- */

.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.service {
  display: flex;
  flex-direction: column;
  padding: 24px;
  scroll-margin-top: 16px;
  transition: background-color 0.2s;
}

.service + .service {
  border-left: 1px solid var(--line);
}

/* every row after the first gets a rule on top, and starts flush with the frame */
.service:nth-child(n + 4) {
  border-top: 1px solid var(--line);
}

.service:nth-child(3n + 1) {
  border-left: 0;
}

/* the last row always fills up: a card alone takes all of it, and the second of two takes the rest */
.service:last-child:nth-child(3n + 1) {
  grid-column: 1 / -1;
}

.service:last-child:nth-child(3n + 2) {
  grid-column: span 2;
}

.service:hover {
  background: var(--paper-2);
}

.service-top {
  display: flex;
  justify-content: space-between;
}

.art {
  width: 100%;
  max-width: 360px;
  height: auto;
  aspect-ratio: 3 / 2;
  margin: 28px auto 32px;
  color: var(--ink);
}

.service h3 {
  font-size: 26px;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.service p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
}

.service-buy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: auto;
  padding-top: 24px;
}

.service p.price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 0;
  color: var(--ink);
  font-family: var(--font-pixel);
}

.amount {
  font-size: 32px;
  line-height: 1;
}

.per {
  color: var(--muted);
  font-size: 16px;
}

.service-buy .btn {
  min-width: 96px;
}

.btn.btn-soon,
.btn.btn-soon:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.details-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  margin-top: 14px;
  padding: 0 0 4px;
  border: 0;
  border-bottom: 1px dashed var(--line-soft);
  background: none;
  color: var(--ink);
  font: 400 14px/1 var(--font-pixel);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.15s;
}

.details-link svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  transition: transform 0.15s;
}

.details-link:hover {
  border-bottom-color: var(--ink);
}

.details-link:hover svg {
  transform: translateX(3px);
}

.details-link:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 4px;
}

/* ---------- service details modal ---------- */

.modal {
  width: min(860px, 100% - 32px);
  max-height: calc(100% - 32px);
  margin: auto;   /* the global reset removes the dialog's own centring */
  padding: 0;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}

.modal[open] {
  animation: modal-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}

:root[data-theme="light"] .modal::backdrop {
  background: rgba(22, 22, 22, 0.35);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px); }
}

.modal-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
}

.modal-close {
  padding: 6px 0 6px 12px;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.modal-close:hover {
  color: var(--ink);
}

.modal-close:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 2px;
  color: var(--ink);
}

.modal-body {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
}

.modal-art {
  display: grid;
  place-items: center;
  padding: 32px;
  border-right: 1px solid var(--line);
  background: repeating-linear-gradient(-45deg, var(--line-soft) 0 1px, transparent 1px var(--hatch-gap));
}

.modal-art .art {
  width: 100%;
  max-width: 360px;
  aspect-ratio: auto;   /* the canvas's own 3:2, kept inside the padding */
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}

.modal-info {
  display: flex;
  flex-direction: column;
  padding: 28px;
}

.modal-info h3 {
  font-size: 30px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.modal-summary {
  margin-top: 10px;
  color: var(--muted);
}

.modal-points {
  display: grid;
  margin: 22px 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.modal-points li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 15px;
}

.modal-points li::before {
  content: "+";
  color: var(--muted);
  font-family: var(--font-pixel);
}

.modal-buy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: auto;
  padding-top: 28px;
}

.modal-buy .price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--font-pixel);
}

.modal-buy .price .label {
  margin-left: 10px;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

body:has(.modal[open]) {
  overflow: hidden;
}

/* ---------- footer ---------- */

.footer-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 56px 24px;
  text-align: center;
}

.footer-center .brand {
  justify-self: auto;
}

.footer-center .brand-name {
  font-size: 30px;
}

.footer-center p {
  max-width: 34ch;
  color: var(--muted);
  font-size: 15px;
}

.socials {
  display: flex;
  gap: 8px;
  padding-top: 10px;
}

.socials a {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-soft);
  color: var(--ink);
  transition: background-color 0.15s;
}

.socials a:hover {
  background: var(--paper-2);
}

/* the footer's .app moves through five colours, holding each for a few seconds */
.brand-name .app-dot {
  color: var(--app-1);
  animation: app-colours 20s ease-in-out infinite;
}

@keyframes app-colours {
  0%, 14% { color: var(--app-1); }
  20%, 34% { color: var(--app-2); }
  40%, 54% { color: var(--app-3); }
  60%, 74% { color: var(--app-4); }
  80%, 94% { color: var(--app-5); }
  100% { color: var(--app-1); }
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  font-size: 14px;
}

/* ---------- blog ---------- */

.nav a[aria-current="page"] {
  color: var(--ink);
}

.blog-head {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding: 88px 24px 36px;
}

.blog-head h1 {
  position: relative;
  font-size: clamp(56px, 10vw, 128px);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.blog-head .sub {
  position: relative;
  max-width: 38ch;
  margin: 0;
}

.read-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 400 14px/1 var(--font-pixel);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.read-link svg,
.back-link svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  transition: transform 0.15s;
}

.post-art {
  display: grid;
  place-items: center;
  padding: 32px;
  background: repeating-linear-gradient(-45deg, var(--line-soft) 0 1px, transparent 1px var(--hatch-gap));
}

.post-art .art {
  width: 100%;
  max-width: 360px;
  aspect-ratio: auto;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.post-featured {
  display: grid;
  grid-template-columns: 1fr 1fr;
  color: inherit;
  text-decoration: none;
  transition: background-color 0.2s;
}

.post-featured:hover,
.post-card:hover {
  background: var(--paper-2);
}

.post-featured:focus-visible,
.post-card:focus-visible,
.post-next:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: -6px;
}

.post-featured .post-art {
  border-right: 1px solid var(--line);
}

.post-featured-copy {
  display: flex;
  flex-direction: column;
  padding: 24px;
}

.post-featured h2 {
  margin-top: auto;
  padding-top: 32px;
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.post-featured p {
  max-width: 46ch;
  margin-top: 12px;
  color: var(--muted);
}

.post-featured .read-link {
  margin-top: 24px;
}

.post-featured:hover .read-link svg,
.post-card:hover .read-link svg {
  transform: translateX(3px);
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
}

.post-card {
  display: flex;
  flex-direction: column;
  padding: 24px;
  color: inherit;
  text-decoration: none;
  transition: background-color 0.2s;
}

.post-card + .post-card {
  border-left: 1px solid var(--line);
}

/* every row after the first gets a rule on top, and starts flush with the frame */
.post-card:nth-child(n + 4) {
  border-top: 1px solid var(--line);
}

.post-card:nth-child(3n + 1) {
  border-left: 0;
}

.post-card h3 {
  font-size: 24px;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.post-card p {
  margin: 8px 0 20px;
  color: var(--muted);
  font-size: 15px;
}

.post-card .read-link {
  margin-top: auto;
  color: var(--muted);
}

.post-empty {
  padding: 64px 24px;
  text-align: center;
}

/* ---------- blog: reading a post ---------- */

.read-progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  height: 4px;
}

.read-progress i {
  display: block;
  height: 100%;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
}

.post-head {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  border-bottom: 1px solid var(--line);
}

.post-title {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 24px;
  border-right: 1px solid var(--line);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font: 400 14px/1 var(--font-pixel);
  letter-spacing: 0.02em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.15s;
}

.back-link svg {
  transform: rotate(180deg);
}

.back-link:hover {
  color: var(--ink);
}

.post-title h1 {
  margin-top: auto;
  padding-top: 64px;
  font-size: clamp(36px, 5vw, 60px);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.post-title .sub {
  max-width: 52ch;
  margin-top: 16px;
}

.post-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
}

.post-side {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  border-right: 1px solid var(--line);
}

.post-side .id-spec {
  margin-top: 0;
  border-top: 0;
}

.post-side .id-spec > div:first-child {
  padding-top: 0;
}

.post-side .btn {
  position: sticky;
  top: 24px;
}

.prose {
  width: 100%;
  min-width: 0;
  max-width: 720px;
  padding: 40px 24px 64px;
  margin-inline: auto;
  font-size: 18px;
  line-height: 1.7;
}

.prose > * + * {
  margin-top: 20px;
}

.prose h2 {
  margin-top: 44px;
  font-size: 28px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

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

.prose ul {
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.prose li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 16px;
  line-height: 1.5;
}

.prose li::before {
  content: "+";
  color: var(--muted);
  font-family: var(--font-pixel);
}

.prose blockquote {
  margin-block: 32px;
  padding: 20px 24px;
  border-block: 1px solid var(--line);
  background: repeating-linear-gradient(-45deg, var(--line-soft) 0 1px, transparent 1px var(--hatch-gap));
  font-size: 24px;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  border-top: 1px solid var(--line);
  font-size: 16px;
  line-height: 1.4;
}

.prose tr {
  border-bottom: 1px solid var(--line-soft);
}

.prose th,
.prose td {
  padding: 12px 0;
  text-align: left;
  vertical-align: baseline;
}

.prose th {
  width: 120px;
  padding-right: 16px;
  color: var(--muted);
  font: 400 14px/1 var(--font-pixel);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.prose .editor {
  margin: 24px 0 0;
}

.admin-error:empty {
  display: none;
}

.prose h2 .label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
}

.prose :not(pre) > code {
  padding: 1px 5px;
  border: 1px solid var(--line-soft);
  background: var(--paper-2);
  font: 400 0.82em/1.5 "JetBrains Mono", ui-monospace, Menlo, monospace;
  overflow-wrap: anywhere;
}

.prose .note {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  font-size: 16px;
  line-height: 1.55;
}

.note .label {
  margin-bottom: 12px;
}

.note p + p {
  margin-top: 10px;
}

.note-warn .label {
  width: fit-content;
  padding: 5px 8px;
  background: var(--ink);
  color: var(--paper);
}

.prose pre {
  overflow-x: auto;
  padding: 18px 20px 22px;
  font: 400 14.5px/1.8 "JetBrains Mono", ui-monospace, Menlo, monospace;
}

.prose .editor-bar {
  grid-template-columns: 1fr auto 1fr;
}

.post-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line);
}

.post-next {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 24px;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-decoration: none;
  transition: background-color 0.15s;
}

.post-next + .post-next {
  border-left: 1px solid var(--line);
  text-align: right;
}

a.post-next:hover {
  background: var(--paper-2);
}

/* ---------- sign up ---------- */

.signup {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  min-height: 660px;
}

.signup-side {
  display: flex;
  flex-direction: column;
  padding: 24px;
  border-right: 1px solid var(--line);
}

.signup-side .mascot {
  width: 240px;
  height: 240px;
  margin: auto;
  cursor: default;
}

.steps {
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.steps li {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-2);
  font: 400 14px/1 var(--font-pixel);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.steps li[aria-current="step"],
.steps li.done {
  color: var(--ink);
}

.steps li.done {
  text-decoration: line-through;
  text-decoration-color: var(--ink-2);
}

.signup-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: 560px;
  margin-inline: auto;
  padding: 48px 24px;
}

.signup-panel h1 {
  font-size: clamp(32px, 4vw, 44px);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.035em;
  outline: 0;
}

.signup-panel .sub {
  max-width: none;
  margin-top: 12px;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.signup-panel strong {
  color: var(--ink);
  font-weight: 500;
}

.fields {
  display: grid;
  gap: 18px;
  margin-top: 28px;
}

.field {
  display: grid;
  gap: 8px;
}

.field input,
.otp input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line-soft);
  border-radius: 0;
  background: var(--paper-2);
  color: var(--ink);
  font: 400 16px/1 var(--font-sans);
  transition: border-color 0.15s;
}

.field input:focus-visible,
.otp input:focus-visible {
  border-color: var(--ink);
  outline: 1px solid var(--ink);
}

.field input[aria-invalid] {
  border-color: var(--ink);
}

.field-error {
  font-size: 14px;
  line-height: 1.3;
}

.field-error:empty {
  display: none;
}

.field-error::before {
  content: "! ";
  font-family: var(--font-pixel);
}

.password-box {
  position: relative;
}

.password-box input {
  padding-right: 68px;
}

.field-toggle {
  position: absolute;
  inset: 1px 1px 1px auto;
  width: 60px;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.field-toggle:hover {
  color: var(--ink);
}

.fields .btn {
  margin-top: 6px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.demo-note {
  margin-top: 20px;
  padding: 10px 14px;
  border: 1px dashed var(--line);
  font-size: 14px;
  line-height: 1.4;
}

.otp {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.otp input {
  height: 60px;
  padding: 0;
  font: 400 24px/1 var(--font-pixel);
  text-align: center;
}

.signup-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}

.text-button {
  padding: 2px 0;
  border: 0;
  border-bottom: 1px dashed var(--line-soft);
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

.text-button:disabled {
  border-bottom-color: transparent;
  color: var(--muted);
  cursor: default;
}

.keys {
  display: grid;
  gap: 18px;
  margin-top: 24px;
}

.key {
  display: grid;
  gap: 8px;
}

.key-box {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
}

.key-box code {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  background: var(--paper-2);
  font: 400 14px/1.5 "JetBrains Mono", ui-monospace, Menlo, monospace;
  overflow-wrap: anywhere;
}

.key-actions {
  display: flex;
  flex: none;
  border-left: 1px solid var(--line);
}

.key-actions button {
  width: 72px;
  border: 0;
  background: none;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.15s;
}

.key-actions button + button {
  border-left: 1px solid var(--line-soft);
}

.key-actions button:hover {
  background: var(--paper-2);
}

.key-actions button:focus-visible,
.field-toggle:focus-visible,
.text-button:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: -2px;
}

.key-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.key-buttons .btn {
  flex: 1;
}

.signup-switch {
  margin-top: 20px;
  color: var(--muted);
  font-size: 15px;
}

.signup-switch a {
  color: var(--ink);
  text-underline-offset: 3px;
}

/* ---------- wallpapers ---------- */

/* the gap shows the background through, which draws the lines between the cards */
.wall-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  border-top: 1px solid var(--line);
  background: var(--line);
}

.wall {
  display: flex;
  flex-direction: column;
  background: var(--paper);
}

.wall img {
  display: block;
  width: 100%;
  height: auto;
  border-bottom: 1px solid var(--line);
}

.wall-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
}

.wall-name {
  display: grid;
  gap: 6px;
}

.wall-name h2 {
  font-size: 18px;
  font-weight: 500;
  text-align: left;   /* an Arabic name keeps its own direction but lines up with the label under it */
}

/* ---------- dashboard ---------- */

.dash-top {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.dash-hello {
  padding: 24px;
  overflow-wrap: anywhere;
}

.dash-hello h1 {
  margin-top: 56px;
  font-size: clamp(36px, 5vw, 60px);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.dash-hello .sub {
  max-width: none;
  margin-top: 8px;
}

.credit {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 24px;
  border-left: 1px solid var(--line);
  background: repeating-linear-gradient(-45deg, var(--line-soft) 0 1px, transparent 1px var(--hatch-gap));
}

.credit-amount {
  margin-top: auto;
  padding-block: 28px 8px;
  font: 400 clamp(36px, 5vw, 56px)/1 var(--font-pixel);
}

.credit-note {
  margin-bottom: auto;
  padding-bottom: 28px;
}

.credit .btn {
  width: 100%;
}

.meter {
  display: block;
  width: 100%;
  height: 16px;
  border: 1px solid var(--ink);
  background: var(--paper);
  appearance: none;
}

.meter::-webkit-progress-bar {
  background: none;
}

.meter::-webkit-progress-value {
  background: repeating-linear-gradient(90deg, var(--ink) 0 6px, transparent 6px 8px);
}

.meter::-moz-progress-bar {
  background: repeating-linear-gradient(90deg, var(--ink) 0 6px, transparent 6px 8px);
}

.meter-note {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  margin-top: 10px;
}

.spend-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.spend-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) 132px;
  gap: 24px;
  align-items: center;
  padding: 16px 24px;
  border-top: 1px solid var(--line-soft);
}

.spend-name {
  display: grid;
  gap: 6px;
  overflow-wrap: anywhere;
}

.spend-name strong {
  font-weight: 500;
}

.spend-amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.dash-note {
  margin: 24px;
}

.key-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.key-service {
  margin: 0;
  padding: 12px 24px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
  font-weight: 400;
}

.key-list > li + li > .key-service {
  border-top: 1px solid var(--line);
}

.key-row {
  display: grid;
  grid-template-columns: 240px 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 18px 24px;
}

.key-row + .key-row {
  border-top: 1px solid var(--line);
}

.key-meta {
  display: grid;
  gap: 8px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.key-meta strong {
  font-size: 18px;
  font-weight: 500;
}

.key-values {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.key-line {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 28px;
}

.key-line .label {
  flex: none;
  width: 62px;
}

.key-line code {
  min-width: 0;
  font: 400 14px/1.4 "JetBrains Mono", ui-monospace, Menlo, monospace;
  overflow-wrap: anywhere;
}

.key-line button {
  width: auto;
  padding: 4px 8px;
  border: 1px solid var(--line-soft);
  background: none;
  color: var(--ink);
  font-size: 12px;
  cursor: pointer;
}

.key-line button:hover {
  background: var(--paper-2);
}

.key-row .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.key-rule {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.5;
}

.pay-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.pay-table th {
  color: var(--muted);
  font: 400 14px/1 var(--font-pixel);
  letter-spacing: 0.02em;
  text-align: left;
  text-transform: uppercase;
}

.pay-table th,
.pay-table td {
  padding: 14px 24px;
  border-bottom: 1px solid var(--line-soft);
}

.pay-table tr:last-child td {
  border-bottom: 0;
}

.pay-table code {
  font: 400 14px/1 "JetBrains Mono", ui-monospace, Menlo, monospace;
}

.modal-small {
  width: min(480px, 100% - 32px);
}

.modal-form {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.modal-form .demo-note {
  margin: 0;
}

.modal-form .key-buttons {
  margin-top: 4px;
}

.amounts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.amount-option {
  height: 64px;
  border: 1px solid var(--line-soft);
  background: none;
  color: var(--ink);
  font: 400 20px/1 var(--font-pixel);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.amount-option small {
  display: block;
  margin-top: 6px;
  font: 400 11px/1 var(--font-sans);
  opacity: 0.7;
}

.amount-option:hover {
  background: var(--paper-2);
}

.amount-option[aria-checked="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

/* ---------- admin ---------- */

.admin-head .view-switch button {
  white-space: nowrap;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.stat {
  display: grid;
  gap: 18px;
  padding: 24px;
  border-top: 1px solid var(--line);
}

.stat + .stat {
  border-left: 1px solid var(--line);
}

.stat:nth-child(3n + 1) {
  border-left: 0;
}

.stat:last-child:nth-child(3n + 1) {
  grid-column: 1 / -1;
}

.stat-value {
  font: 400 clamp(28px, 4vw, 44px)/1 var(--font-pixel);
  overflow-wrap: anywhere;
}

.admin-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.admin-split > section {
  min-width: 0;
}

.admin-split > section + section {
  border-left: 1px solid var(--line);
}

/* ---------- admin: live now ---------- */

.live-body {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) 2fr;
}

.live-total {
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 24px;
  border-right: 1px solid var(--line);
}

.live-tv {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

.live-tv .stat-value {
  font-size: 24px;
}

.live-body .ranks > .muted {
  font-size: 15px;
}

.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 10px;
  border-radius: 50%;
  background: #3ecf7a;
  vertical-align: 1px;
  animation: live-pulse 2s ease-in-out infinite;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@media (max-width: 720px) {
  .live-body { grid-template-columns: 1fr; }
  .live-total { border-right: 0; border-bottom: 1px solid var(--line); }
}

.days {
  display: flex;
  align-items: stretch;
  gap: 2px;
  height: 220px;
  margin: 24px 24px 0;
  padding: 0;
  border-bottom: 1px solid var(--line);
  list-style: none;
}

/* the whole column is the hover target, not just the bar */
.day {
  position: relative;
  display: flex;
  flex: 1;
  align-items: flex-end;
  outline: 0;
}

.day i {
  width: 100%;
  background: var(--ink-2);
  transition: background-color 0.1s;
}

.day.today i,
.day:hover i,
.day:focus-visible i {
  background: var(--ink);
}

.day-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% - 22px);
  z-index: 2;
  display: none;
  padding: 6px 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 12px;
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
}

.day:first-child .day-tip { left: 0; transform: none; }
.day:last-child .day-tip { left: auto; right: 0; transform: none; }

.day:hover .day-tip,
.day:focus-visible .day-tip {
  display: block;
}

.days-axis {
  display: flex;
  justify-content: space-between;
  padding: 10px 24px 20px;
  font-size: 12px;
}

.ranks {
  display: grid;
  gap: 16px;
  padding: 24px;
}

.rank {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  align-items: baseline;
  min-width: 0;
}

.rank-name {
  min-width: 0;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.rank-name .label {
  margin-left: 6px;
  font-size: 12px;
}

.rank-value {
  font: 400 15px/1 var(--font-pixel);
}

.rank-bar {
  grid-column: 1 / -1;
  height: 8px;
  background: var(--paper-2);
}

.rank-bar i {
  display: block;
  height: 100%;
  background: var(--ink);
}

.table-scroll {
  overflow-x: auto;
}

.table-scroll .pay-table {
  min-width: 560px;
}

.admin-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.admin-row {
  display: grid;
  grid-template-columns: 1fr 1fr 92px;   /* the last column stays when a row has no Delete */
  align-items: center;
  gap: 20px;
  padding: 16px 24px;
}

.admin-row + .admin-row {
  border-top: 1px solid var(--line);
}

.admin-posts .admin-row {
  grid-template-columns: 1fr auto auto;
}

.admin-title {
  margin-bottom: 8px;
  font-size: 17px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.admin-row .label {
  font-size: 12px;
  line-height: 1.4;
}

.admin-select {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.admin-actions {
  display: flex;
  gap: 8px;
}

.admin-row .btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

.field select,
.field textarea,
.admin-select select {
  width: 100%;
  min-width: 0;
  padding: 0 14px;
  border: 1px solid var(--line-soft);
  border-radius: 0;
  background: var(--paper-2);
  color: var(--ink);
  font: 400 16px/1.5 var(--font-sans);
}

.field select {
  height: 46px;
}

.admin-select select {
  height: 40px;
  font-size: 14px;
}

.field textarea {
  padding-block: 10px;
  resize: vertical;
}

.field select:focus-visible,
.field textarea:focus-visible,
.admin-select select:focus-visible {
  border-color: var(--ink);
  outline: 1px solid var(--ink);
}

.field textarea[aria-invalid] {
  border-color: var(--ink);
}

.admin-form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  max-width: 820px;
  padding: 24px;
}

.admin-form .wide {
  grid-column: 1 / -1;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 30;
  padding: 12px 18px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font: 400 14px/1 var(--font-pixel);
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- smaller screens ---------- */

@media (max-width: 980px) {
  .wall-grid { grid-template-columns: repeat(2, 1fr); }
  .nav { display: none; }
  .bar { grid-template-columns: 1fr auto; }
  .services-grid { grid-template-columns: 1fr; }
  .service:last-child:nth-child(3n + 2) { grid-column: auto; }
  .service + .service { border-left: 0; border-top: 1px solid var(--line); }
  .readme-grid,
  .readme-chat { grid-template-columns: 1fr; }
  .id-card { border-left: 0; border-top: 1px solid var(--line); }
  .chat-avatar { flex-direction: row; justify-content: flex-start; gap: 16px; padding: 20px 24px; border-right: 0; border-bottom: 1px solid var(--line); }
  .chat-avatar .mascot { width: 120px; height: 120px; margin: 0; }
  .chat-who { justify-items: start; }
  .modal-body { grid-template-columns: 1fr; }
  .modal-art { padding: 20px; border-right: 0; border-bottom: 1px solid var(--line); }
  .modal-art .art { max-width: 240px; padding: 10px; }
  .admin-split,
  .admin-row,
  .admin-posts .admin-row { grid-template-columns: 1fr; }
  .admin-split > section + section { border-top: 1px solid var(--line); border-left: 0; }
  .admin-row { gap: 12px; }
  .dash-top,
  .key-row { grid-template-columns: 1fr; }
  .credit { border-top: 1px solid var(--line); border-left: 0; }
  .spend-row { grid-template-columns: 1fr; gap: 10px; }
  .wall-grid { grid-template-columns: 1fr; }
  .spend-amount { text-align: left; }
  .dash-hello h1 { margin-top: 32px; }
  .key-row { gap: 14px; }
  .signup { grid-template-columns: 1fr; min-height: 0; }
  .signup-side { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px 16px; padding: 16px 24px; border-right: 0; border-bottom: 1px solid var(--line); }
  .signup-side .mascot { grid-row: 1 / span 2; grid-column: 2; width: 96px; height: 96px; margin: 0; }
  .steps { border-top: 0; }
  .steps li { padding: 6px 0; border-bottom: 0; font-size: 13px; }
  .post-featured,
  .post-head,
  .post-layout,
  .post-grid { grid-template-columns: 1fr; }
  .post-featured .post-art { border-right: 0; border-bottom: 1px solid var(--line); }
  .post-card + .post-card { border-left: 0; border-top: 1px solid var(--line); }
  .post-title { border-right: 0; border-bottom: 1px solid var(--line); }
  .post-art { padding: 20px; }
  .post-art .art { max-width: 240px; padding: 10px; }
  .post-side { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; border-right: 0; border-bottom: 1px solid var(--line); }
  .post-side .id-spec { display: flex; flex-wrap: wrap; gap: 8px 28px; }
  .post-side .id-spec > div { display: flex; gap: 8px; padding: 0; border: 0; }
  .post-side .btn { position: relative; }   /* keeps the corner marks on the button */
}

@media (max-width: 720px) {
  .hero-copy { padding-top: 72px; }
  .landscape { height: 220px; margin-top: 48px; }
  .blog-head { flex-direction: column; align-items: flex-start; gap: 16px; padding-top: 56px; }
  .prose { font-size: 17px; }
  .admin-head { flex-direction: column; align-items: stretch; }
  .admin-head .view-switch { overflow-x: auto; }
  .admin-head .view-switch button { flex: 1 1 auto; padding: 8px 6px; font-size: 12px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3n + 1) { border-left: 1px solid var(--line); }
  .stat:nth-child(2n + 1) { border-left: 0; }
  .admin-form { grid-template-columns: 1fr; }
  .post-filter { flex-direction: column; align-items: stretch; }
  .post-filter .view-switch { overflow-x: auto; }
  .post-filter .view-switch button { flex: 1 1 auto; white-space: nowrap; }
  .footer-center { padding: 44px 20px; }
}

@media (max-width: 480px) {
  .frame { width: calc(100% - 16px); margin: 8px auto; }
  .bar { padding: 12px 14px; }
  .bar { gap: 12px; }
  .bar-actions .btn-solid { display: none; }
  .bar-actions .btn-outline:not(.btn-square) { padding: 0 12px; }
  .signup-panel { padding: 32px 20px; }
  .otp { gap: 6px; }
  .otp input { height: 52px; font-size: 20px; }
  .key-box { flex-direction: column; }
  .key-actions { border-top: 1px solid var(--line); border-left: 0; }
  .key-actions button { flex: 1; height: 40px; }
  .cta { width: 100%; }
  .cta .btn { flex: 1; padding: 0 14px; }
  .service { padding: 20px; }
  .footer-bottom { padding: 16px 20px; }
  .editor,
  .chat-window { margin: 16px; }
  .thread { padding: 16px; }
  .msg { font-size: 13px; }
  .id-card .mascot { width: 240px; height: 240px; }
  .modal-info { padding: 20px; }
  .modal-info h3 { font-size: 26px; }
  .modal-actions { width: 100%; }
  .modal-actions .btn { flex: 1; }
  .post-filter .view-switch button { padding: 8px 3px; font-size: 12px; }
  .pay-table th,
  .pay-table td { padding: 12px 8px; font-size: 13px; }
  .pay-table th:first-child,
  .pay-table td:first-child { padding-left: 20px; }
  .pay-table th:nth-child(2),
  .pay-table td:nth-child(2) { display: none; }
  .table-scroll .pay-table th:nth-child(2),
  .table-scroll .pay-table td:nth-child(2) { display: table-cell; }
  .key-line { gap: 8px; }
  .key-line .label { width: 52px; font-size: 12px; }
  .key-line code { font-size: 12px; }
  .amount-option { height: 56px; font-size: 16px; }
  .post-card { padding: 20px; }
  .post-pager { grid-template-columns: 1fr; }
  .post-next + .post-next { border-left: 0; border-top: 1px solid var(--line); text-align: left; }
  .post-next[aria-hidden="true"] { display: none; }
  .code { font-size: 12px; }
  .code-line { grid-template-columns: 34px 1fr; }
  .code-line .ln { padding-right: 10px; }
  /* long lines wrap under their own indent instead of scrolling */
  .code-line .src { padding-right: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
}

@media (max-width: 360px) {
  .brand-name { display: none; }
  .footer-center .brand-name { display: inline; }   /* the footer has room for it */
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .brand-name .app-dot { animation: none; }
  .live-dot { animation: none; }
  .btn,
  .toast { transition: none; }
  .code.done .caret,
  .readme-chat.typing .chat-status i,
  .msg-typing i { animation: none; }
  .msg,
  .msg .chips li,
  .modal[open] { animation: none; }
}

/* Screenshots in the Qi TV usage guide. */
.prose .qitv-guide figure,.prose .guide figure{margin:2rem 0;border:1px solid var(--line,#b8b3a7);padding:10px;background:var(--paper,#f4f1e9)}
.prose .qitv-guide figure img,.prose .guide figure img{display:block;width:100%;height:auto;border:0}
.prose .qitv-guide figcaption,.prose .guide figcaption{margin-top:10px;font-size:.8em;line-height:1.6;opacity:.7}
.prose .qitv-guide .guide-open,.prose .guide .guide-open{display:inline-block;margin:.5rem 0;padding:.7rem 1.2rem;border:1px solid currentColor;text-decoration:none}
