/* catcloud — site styles.
   Night sky, Tuft's lavender, pixel type for headings only, everything else
   plain and readable. Spaces (/~name) bring their own styles; this file only
   dresses the site around them. */

@font-face {
  font-family: tuftpix;
  src: url(/fonts/tuftpix.woff) format("woff");
  font-display: swap;
}

:root {
  --bg: #0e0b16;
  --bg-up: #151022;
  --sky: #1a1330;
  --line: #2a2140;
  --line-up: #3b2f59;
  --text: #ebe5f6;
  --dim: #a59bbb;
  --faint: #6f6587;
  --accent: #b8a3fb;
  --accent-deep: #8f6fe8;
  --ink: #2e1660;
  --pink: #f49ad8;
  --ok: #8fe3b0;
  --bad: #ff8e9e;
  --pix: tuftpix, ui-monospace, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--pink); }
::selection { background: var(--accent); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
main:focus { outline: none; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

h1, h2, h3 { font-family: var(--pix); font-weight: normal; margin: 0; line-height: 1.2; }
h1 { font-size: 30px; color: var(--accent); }
h2 { font-size: 20px; }
.dim { color: var(--dim); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); font-size: 13px; }
.small { font-size: 14px; }

/* ---- sky + header ----------------------------------------------------- */
.sky {
  position: relative;
  background: linear-gradient(var(--sky), var(--bg));
  border-bottom: 1px solid var(--line);
}
.sky canvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.top {
  position: relative;
  max-width: 880px; margin: 0 auto;
  padding: 18px 16px 44px;
  display: flex; align-items: baseline; gap: 20px; flex-wrap: wrap;
  pointer-events: none;
}
.top > * { pointer-events: auto; }
.mark { font-family: var(--pix); font-size: 20px; color: var(--text); text-decoration: none; }
.mark b { color: var(--accent); font-weight: normal; }
.top nav { display: flex; gap: 16px; flex-wrap: wrap; font-size: 15px; }
.top nav a { color: var(--dim); text-decoration: none; }
.top nav a:hover, .top nav a[aria-current] { color: var(--text); }
.top nav .dot { display: inline-block; width: 6px; height: 6px; background: var(--pink); margin-left: 4px; vertical-align: 6px; }
.top .me { margin-left: auto; font-size: 15px; color: var(--dim); display: flex; gap: 14px; }
.top .me a { text-decoration: none; }
.linkish { background: none; border: 0; padding: 0; color: var(--dim); cursor: pointer; }
.linkish:hover { color: var(--text); }
.skip { position: absolute; left: 8px; top: -60px; z-index: 70; background: var(--accent); color: var(--ink); padding: 6px 12px; font-weight: 600; text-decoration: none; }
.skip:focus { top: 8px; color: var(--ink); }
/* dropdowns: "more" in the nav, and your own things under your name */
.top nav, .top .me { align-items: baseline; }
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; color: var(--dim); white-space: nowrap; }
.menu summary::-webkit-details-marker { display: none; }
.menu summary::after { content: ""; display: inline-block; margin-left: 6px; vertical-align: 3px; border: 4px solid transparent; border-top-color: currentColor; border-bottom: 0; }
.menu[open] summary::after { border-top: 0; border-bottom: 4px solid currentColor; vertical-align: 4px; }
.menu summary:hover, .menu summary.on, .menu[open] summary { color: var(--text); }
.menu .menu-box {
  position: absolute; z-index: 60; top: calc(100% + 10px); left: -12px; min-width: 170px;
  display: flex; flex-direction: column; padding: 6px 0;
  background: var(--bg-up); border: 2px solid var(--line); box-shadow: 4px 4px 0 rgba(0, 0, 0, .35);
}
.menu.mine .menu-box { left: auto; right: -12px; }
.menu .menu-box a, .menu .menu-box .linkish { padding: 7px 14px; color: var(--dim); text-decoration: none; text-align: left; font: inherit; }
.menu .menu-box a:hover, .menu .menu-box .linkish:hover, .menu .menu-box a[aria-current] { color: var(--text); background: var(--bg); }
.menu .menu-box .linkish { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 10px; }
@media (max-width: 560px) {
  /* the nav gets its own row, one line, spread out so each link is an easy
     tap; menus open full width under the bar */
  .top { gap: 0 16px; padding: 10px 16px 18px; align-items: center; }
  .top .mark { padding: 8px 0; }
  .top .me { gap: 12px; }
  .top .me a, .top .me summary { padding: 10px 0; }
  .top nav {
    order: 3; flex-basis: 100%; flex-wrap: nowrap; justify-content: space-between; gap: 8px;
    overflow-x: auto; scrollbar-width: none; margin: 0 -4px;
  }
  .top nav::-webkit-scrollbar { display: none; }
  .top nav a, .top nav summary { white-space: nowrap; padding: 10px 4px; }
  .top nav .dot { margin-left: 2px; }
  .menu { position: static; }
  .menu .menu-box, .menu.mine .menu-box { left: 16px; right: 16px; top: auto; margin-top: 0; }
  .menu.more .menu-box { display: grid; grid-template-columns: 1fr 1fr; }
  .menu .menu-box a, .menu .menu-box .linkish { padding: 12px 16px; font-size: 16px; }
  .menu.more .menu-box .linkish { grid-column: 1 / -1; }
}
@media (max-width: 380px) { .top nav { font-size: 14px; gap: 4px; } .top nav a, .top nav summary { padding: 10px 2px; } }

/* ---- page ---------------------------------------------------------------- */
main.page { width: 100%; max-width: 880px; margin: 0 auto; padding: 32px 16px 120px; flex: 1; }
.lede { max-width: 560px; margin: 12px 0 0; color: var(--dim); font-size: 17px; }
section { margin-top: 44px; }
.label {
  font-size: 13px; letter-spacing: .08em; color: var(--faint);
  display: flex; gap: 12px; align-items: baseline; margin-bottom: 10px;
}
.label a { margin-left: auto; letter-spacing: 0; }

.rows { border-top: 1px solid var(--line); }
.row {
  display: flex; gap: 16px; align-items: baseline;
  padding: 12px 4px; border-bottom: 1px solid var(--line);
  text-decoration: none; color: var(--text);
}
a.row:hover { background: var(--bg-up); color: var(--text); }
a.row:hover .row-title { color: var(--accent); }
.row-title { min-width: 140px; font-weight: 600; }
.row-desc { color: var(--dim); flex: 1; }
.row-meta { color: var(--faint); font-size: 13px; white-space: nowrap; }
.swatch { width: 10px; height: 10px; display: inline-block; margin-right: 8px; vertical-align: 1px; }
.swatch.pfp { width: 20px; height: 20px; object-fit: cover; vertical-align: -5px; }
@media (max-width: 560px) {
  .row { flex-wrap: wrap; gap: 2px 12px; }
  .row-title { min-width: 0; }
  .row-desc { flex-basis: 100%; order: 3; }
}

footer.foot {
  max-width: 880px; width: 100%; margin: 0 auto; padding: 24px 16px 96px;
  border-top: 1px solid var(--line); color: var(--faint); font-size: 13px;
  display: flex; gap: 16px; flex-wrap: wrap;
}
footer.foot .linkish { color: var(--faint); font-size: 13px; }
footer.foot .linkish:hover { color: var(--dim); }

/* ---- forms ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: var(--ink); border: 0;
  padding: 9px 18px; font-weight: 600; cursor: pointer; text-decoration: none;
  box-shadow: 3px 3px 0 var(--ink);
}
.btn:hover { background: var(--pink); color: var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn.ghost { background: transparent; color: var(--text); box-shadow: none; border: 1px solid var(--line-up); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn[disabled] { opacity: .5; cursor: default; }
.field { display: grid; gap: 4px; margin-bottom: 14px; }
.field > span { font-size: 13px; color: var(--dim); }
.field small { color: var(--faint); font-size: 12px; }
input[type=text], input[type=password], input[type=url], input[type=search], input:not([type]), textarea, select {
  width: 100%; background: var(--bg); border: 1px solid var(--line-up); padding: 8px 10px; border-radius: 0;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); outline: none; }
textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
textarea.code { font-family: var(--mono); font-size: 13px; tab-size: 2; }
.err { color: var(--bad); min-height: 1.6em; margin: 0 0 8px; }

/* ---- tuft ------------------------------------------------------------ */
.tuft {
  --s: 1; --row: 0; --spd: 1s;
  width: calc(80px * var(--s)); height: calc(72px * var(--s));
  background: url(/img/tuft.png) no-repeat;
  background-size: calc(320px * var(--s)) calc(576px * var(--s));
  background-position: 0 calc(-72px * var(--s) * var(--row));
  image-rendering: pixelated;
  animation: tuft-frames var(--spd) steps(4) infinite;
  flex-shrink: 0;
}
.tuft.flip { transform: scaleX(-1); }
@keyframes tuft-frames { to { background-position-x: calc(-320px * var(--s)); } }

.pet {
  position: fixed; left: 0; bottom: 0; z-index: 40;
  transition: transform 0s linear;
  will-change: transform;
}
/* on a phone there's no room for him to walk over the page, so he walks
   along the bottom of it instead, by the footer */
@media (max-width: 700px) {
  body { position: relative; }
  .pet { position: absolute; }
}
.pet .tuft { cursor: pointer; }
.pet .tuft:focus-visible { outline-offset: -2px; }
.pet .bubble {
  position: absolute; bottom: 74px; left: 30px;
  width: max-content; max-width: min(260px, 70vw);
  background: var(--text); color: #1a1222; padding: 8px 12px; font-size: 14px; line-height: 1.4;
  box-shadow: 3px 3px 0 var(--ink);
  animation: pop .2s var(--ease);
}
.pet .bubble::after { content: ""; position: absolute; left: 18px; bottom: -8px; border: 4px solid transparent; border-top-color: var(--text); border-left-color: var(--text); }
.pet.right .bubble { left: auto; right: 30px; }
.pet.right .bubble::after { left: auto; right: 18px; border-left-color: transparent; border-right-color: var(--text); }
@keyframes pop { from { transform: translateY(4px) scale(.96); opacity: 0; } }

/* ---- toasts ---------------------------------------------------------- */
.toasts { position: fixed; top: 16px; left: 0; right: 0; z-index: 60; display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: var(--bg-up); border: 1px solid var(--line-up); padding: 8px 16px; font-size: 14px; box-shadow: 3px 3px 0 #000; animation: pop .2s var(--ease); pointer-events: auto; cursor: default; max-width: 100%; overflow-wrap: anywhere; }
.toast.bad { border-color: var(--bad); }
.toast.ok { border-color: var(--accent-deep); }

/* ---- keys (press ?) ------------------------------------------------- */
dialog.keys {
  background: var(--bg-up); color: var(--text); border: 1px solid var(--line-up);
  box-shadow: 4px 4px 0 #000; padding: 20px 24px; width: min(420px, calc(100vw - 32px));
}
dialog.keys::backdrop { background: rgba(8, 6, 14, .7); }
dialog.keys h2 { margin-bottom: 12px; }
dialog.keys dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 16px; font-size: 14px; }
dialog.keys dd { margin: 0; color: var(--dim); }
kbd {
  font-family: var(--mono); font-size: 12px; padding: 1px 6px; color: var(--text);
  border: 1px solid var(--line-up); border-bottom-width: 2px; background: var(--bg);
}

/* ---- little shared bits ------------------------------------------------ */
.empty { color: var(--dim); padding: 16px 4px; margin: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters input { flex: 1 1 200px; width: auto; }
.filters select { width: auto; }

@media (prefers-reduced-motion: reduce) {
  .tuft { animation-duration: 0s !important; }
  * { transition: none !important; }
}

/* ---- report box ------------------------------------------------------ */
dialog.report {
  background: var(--bg-up); color: var(--text); border: 1px solid var(--line-up);
  padding: 20px; width: min(420px, calc(100vw - 32px)); box-shadow: 4px 4px 0 #000;
}
dialog.report::backdrop { background: rgba(14, 11, 22, .7); }
dialog.report h2 { margin-bottom: 4px; overflow-wrap: anywhere; }
dialog.report fieldset { border: 0; padding: 0; margin: 12px 0; display: grid; gap: 2px; }
dialog.report .pick { cursor: pointer; }
dialog.report .row-btns { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---- touch screens ------------------------------------------------------ */
@media (pointer: coarse) {
  /* phones zoom the page in on anything smaller when you tap into it */
  input, textarea, select { font-size: 16px !important; }
  .btn { padding: 11px 18px; }
  .btn.small { padding: 8px 12px; }
  footer.foot { gap: 4px 18px; }
  footer.foot a, footer.foot .linkish { padding: 8px 0; }
}
