/* Ramat: a herd of Clawds in a pixel-art meadow. Thick dark outlines and hard shadows, like an
   old game; sky, grass and Clawd orange. Fonts are served from this server (CSP: no CDNs). */

@font-face { font-family: "Pixelify Sans"; font-weight: 400 700; font-display: swap; src: url(/fonts/pixelify.woff2) format("woff2"); }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 400 800; font-display: swap; src: url(/fonts/nunito.woff2) format("woff2"); }
@font-face { font-family: "Nunito"; font-style: italic; font-weight: 400 800; font-display: swap; src: url(/fonts/nunito-italic.woff2) format("woff2"); }
@font-face { font-family: "Plex Mono"; font-weight: 400; font-display: swap; src: url(/fonts/plex-mono-400.woff2) format("woff2"); }
@font-face { font-family: "Plex Mono"; font-weight: 500; font-display: swap; src: url(/fonts/plex-mono-500.woff2) format("woff2"); }

:root {
  color-scheme: light;
  --bg: #eef7fc;
  --card: #ffffff;
  --ink: #2a1f1a;
  --ink-soft: #54473e;
  --muted: #7d7067;
  --line: #2a1f1a;
  --line-soft: #cfdde6;
  --clawd: #d97757;
  --clawd-hot: #e8896a;
  --clawd-wash: #fde6dc;
  --grass: #4f8f3a;
  --grass-wash: #e2f2d6;
  --sky: #8fcbee;
  --sky-wash: #d6ecf8;
  --sun: #ffd75e;
  --code-bg: #2a1f1a;
  --code-ink: #f6eee2;
  --pixel: "Pixelify Sans", ui-monospace, monospace;
  --sans: "Nunito", ui-rounded, system-ui, -apple-system, sans-serif;
  --mono: "Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --b: 3px;
  --shadow: 5px 5px 0 var(--line);
  --shadow-small: 3px 3px 0 var(--line);
}
@media (prefers-color-scheme: dark) {
  /* Night in the meadow. */
  :root {
    color-scheme: dark;
    --bg: #131a2c;
    --card: #1d2640;
    --ink: #f6efe4;
    --ink-soft: #d3cabc;
    --muted: #9c95a6;
    --line: #04060d;
    --line-soft: #2c3757;
    --clawd: #e8896a;
    --clawd-hot: #f29c7f;
    --clawd-wash: #3e2621;
    --grass: #86c46e;
    --grass-wash: #1d3322;
    --sky: #34477a;
    --sky-wash: #1a2442;
    --code-bg: #0b0f1c;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font: 500 1.0625rem/1.6 var(--sans); -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column;
}
::selection { background: var(--clawd); color: var(--ink); }
a { color: inherit; text-decoration-color: var(--clawd); text-decoration-thickness: 2px; text-underline-offset: .2em; }
a:hover { color: var(--clawd); }
:focus-visible { outline: var(--b) solid var(--clawd); outline-offset: 3px; }
p { margin: 0 0 1rem; }
strong { font-weight: 800; }
code { font-family: var(--mono); font-size: .86em; background: var(--sky-wash); padding: .1rem .35rem; border-radius: 2px; }
pre { margin: 0; overflow-x: auto; background: var(--code-bg); color: var(--code-ink); border: var(--b) solid var(--line); padding: 1rem 1.1rem; }
pre code { background: none; padding: 0; font-size: .82rem; line-height: 1.7; white-space: pre; }
h1, h2, h3 { font-family: var(--pixel); font-weight: 600; line-height: 1.1; margin: 0; letter-spacing: .01em; }
h1 { font-size: clamp(2.2rem, 4.4vw, 3.4rem); }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); }
h3 { font-size: 1.35rem; }
h1 em, h2 em, .lede em, .kicker em { font-style: normal; color: var(--clawd); }
.pixel-font { font-family: var(--pixel); font-weight: 600; }
.pixel { image-rendering: pixelated; image-rendering: crisp-edges; max-width: 100%; height: auto; display: block; }
.muted { color: var(--muted); }

/* Labels, nav and buttons speak in the pixel font. */
.label, label > span, .kicker, dt, .tag, .state {
  font-family: var(--pixel); font-weight: 500; font-size: .95rem; letter-spacing: .02em;
}

.kicker { color: var(--ink-soft); margin: 0 0 1rem; font-size: 1.05rem; }

.wordmark { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ink); }
.wordmark img { width: 2.25rem; height: 2.25rem; image-rendering: pixelated; }
.wordmark span { font: 700 1.6rem/1 var(--pixel); }
.wordmark:hover { color: var(--ink); }

/* ---------- Buttons: chunky, with a hard shadow that you press into. ---------- */

button, .btn {
  font: 600 1.05rem/1 var(--pixel); letter-spacing: .02em; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: .6rem; justify-self: start;
  color: var(--ink); background: var(--clawd); border: var(--b) solid var(--line); border-radius: 0;
  padding: .8rem 1.25rem .75rem; box-shadow: var(--shadow-small);
  transition: transform .08s, box-shadow .08s, background .12s;
}
button:hover, .btn:hover { background: var(--clawd-hot); color: var(--ink); transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--line); }
button:active, .btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--line); }
.btn.go::after, button.go::after { content: "▶"; font-size: .7em; }
button.ghost, .btn.ghost { background: var(--card); }
button.ghost:hover, .btn.ghost:hover { background: var(--sky-wash); }
button.danger { background: #e2513a; color: #fff; }
button.danger:hover { background: #f0644c; color: #fff; }
.btn.small { padding: .5rem .85rem .45rem; font-size: .95rem; }
button.link {
  background: none; border: 0; box-shadow: none; padding: 0; color: var(--muted);
  font: 500 .95rem var(--pixel); text-decoration: underline; text-decoration-color: var(--line-soft); text-underline-offset: .3em;
}
button.link:hover { color: var(--clawd); background: none; transform: none; box-shadow: none; }
.buttons { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }

/* ---------- Forms ---------- */

form { margin: 0; }
.fields { display: grid; gap: 1.1rem; }
label { display: grid; gap: .35rem; }
label > span { color: var(--ink-soft); }
input {
  font: 600 1.05rem/1.3 var(--sans); color: var(--ink); background: var(--card); width: 100%;
  border: var(--b) solid var(--line); border-radius: 0; padding: .65rem .8rem;
}
input::placeholder { color: var(--muted); font-weight: 500; }
input:focus { outline: none; box-shadow: 0 0 0 var(--b) var(--clawd); }
input[readonly] { font: 400 .9rem/1.4 var(--mono); color: var(--ink-soft); background: var(--sky-wash); }
.code-input { font: 600 2rem/1 var(--pixel); letter-spacing: .2em; text-transform: uppercase; }
.hint { color: var(--muted); font-size: .95rem; }

/* Messages: a speech bubble from the herd. */
.error, .notice {
  position: relative; border: var(--b) solid var(--line); background: var(--clawd-wash);
  padding: .75rem 1rem; margin: 0 0 1.5rem; box-shadow: var(--shadow-small); font-weight: 600;
}
.notice { background: var(--grass-wash); }
.error::before, .notice::before { display: block; font: 600 .95rem var(--pixel); margin-bottom: .15rem; }
.error::before { content: "Oops!"; color: var(--clawd); }
.notice::before { content: "Done!"; color: var(--grass); }

/* ---------- Top bar and footer ---------- */

.topbar {
  display: flex; align-items: center; gap: 2rem; padding: .85rem clamp(1rem, 4vw, 2.5rem);
  background: var(--card); border-bottom: var(--b) solid var(--line); position: relative; z-index: 2;
}
.topbar nav { display: flex; align-items: center; gap: 1.5rem; }
.topbar nav a:not(.btn) { font: 500 1.1rem var(--pixel); text-decoration: none; color: var(--ink-soft); padding: .2rem 0; border-bottom: var(--b) solid transparent; }
.topbar nav a:not(.btn):hover { color: var(--ink); }
.topbar nav a[aria-current] { color: var(--ink); border-bottom-color: var(--clawd); }
.topbar .who { margin-left: auto; display: flex; gap: 1rem; align-items: baseline; color: var(--ink-soft); font-weight: 700; }

.foot {
  margin-top: auto; padding: 2rem clamp(1rem, 4vw, 2.5rem); border-top: var(--b) solid var(--line);
  background: var(--card); display: flex; flex-wrap: wrap; gap: .25rem 2rem; justify-content: space-between; align-items: baseline;
}
.foot p { margin: 0; }
.foot em { font-style: normal; color: var(--clawd); font-weight: 800; }
.foot .fine { color: var(--muted); font-size: .9rem; }

/* ---------- Login and sign-up: the form on the dusk of the home page. ---------- */

/* The scene of the home page with the herd baked in (dusk-still.png), darkened so the card
   stands out. Scaled by whole numbers, like on the home page, wide enough to fill the screen. */
.auth {
  --s: 2; min-height: 100vh; display: flex; flex-direction: column; color: #f6ecdc;
  background: linear-gradient(rgb(11 8 24 / .6), rgb(11 8 24 / .6)),
    url(/img/dusk-still.png) center bottom / calc(480px * var(--s)) auto no-repeat, #17122e;
  image-rendering: pixelated;
}
@media (min-width: 60rem) { .auth { --s: 3; } }
@media (min-width: 90.0625rem) { .auth { --s: 4; } }
@media (min-width: 120.0625rem) { .auth { --s: 5; } }
.cover { padding: 1.5rem clamp(1rem, 4vw, 3rem); }
.cover .wordmark, .cover .wordmark:hover { color: #f6ecdc; }
.panel {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 1rem 1rem 4rem; image-rendering: auto;
}
.lede {
  font: 600 clamp(1.6rem, 3vw, 2.3rem)/1.15 var(--pixel); margin: 0 0 1.6rem; max-width: 26ch; text-wrap: balance;
  text-align: center; color: #f6ecdc; text-shadow: 0 .07em 0 #0b0818;
}
.lede em { color: #ee8c66; }
/* The form: a card like the ones of the app, in the page colour scheme. */
.panel > div {
  box-sizing: border-box; width: 100%; max-width: 27rem; background: var(--card); color: var(--ink);
  border: var(--b) solid #0b0818; box-shadow: 8px 8px 0 #0b0818; padding: 2rem clamp(1.25rem, 4vw, 2.25rem);
}
.panel h1 { font-size: 2.4rem; margin-bottom: .6rem; }
.panel .intro { color: var(--ink-soft); margin-bottom: 2rem; }
.panel .fields { margin-bottom: 1.75rem; }
.panel .after { margin-top: 2.25rem; margin-bottom: 0; color: var(--muted); font-size: .98rem; }

@media (max-width: 52rem) {
  .lede { font-size: 1.5rem; }
  .panel { justify-content: flex-start; padding-top: .5rem; }
}

/* ---------- The app: the herd page, account, adding a field. ---------- */

.page { width: 100%; max-width: 72rem; margin: 0 auto; padding: 2.5rem clamp(1rem, 4vw, 2.5rem) 5rem; }
.title-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem 2rem; margin-bottom: 2.5rem; }
.title-row .tally { margin: 0; font: 500 1.1rem var(--pixel); color: var(--ink-soft); }
.title-row .tally b { color: var(--ink); font-weight: 700; }
section + section { margin-top: 3.5rem; }
.section-head { display: flex; align-items: center; gap: .9rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.section-head img { height: auto; image-rendering: pixelated; }
.section-head h2 { font-size: 1.9rem; }
.section-head .count {
  font: 700 1rem/1 var(--pixel); background: var(--sun); color: #2a1f1a; border: var(--b) solid var(--line);
  padding: .25rem .5rem;
}
.section-head p { margin: 0 0 0 auto; color: var(--muted); font-size: .98rem; }

.ledger { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.25rem; }
.entry {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .4rem 2rem;
  background: var(--card); border: var(--b) solid var(--line); box-shadow: var(--shadow); padding: 1.25rem 1.4rem;
}
.entry:target { box-shadow: 0 0 0 var(--b) var(--clawd), var(--shadow); }
.entry h3 { font-size: 1.6rem; display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; overflow-wrap: anywhere; }
.facts { grid-column: 1; display: flex; flex-wrap: wrap; gap: .6rem 1.8rem; margin: .6rem 0 0; }
.facts div { display: grid; gap: .05rem; }
dt { color: var(--muted); font-size: .85rem; }
dd { margin: 0; font: 400 .85rem/1.4 var(--mono); color: var(--ink-soft); }
dd .soft { color: var(--muted); }
.actions { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 1.25rem; align-items: flex-start; padding-top: .4rem; }
.empty {
  display: flex; align-items: center; gap: 1.25rem; padding: 1.5rem; margin: 0;
  background: var(--card); border: var(--b) dashed var(--line-soft); color: var(--ink-soft);
}
.empty img { flex: none; image-rendering: pixelated; }
.empty p { margin: 0; }

/* Online: a green light that blinks like an old console. */
.state { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .9rem; }
.state::before { content: ""; width: .6rem; height: .6rem; border: 2px solid currentColor; }
.state.on { color: var(--grass); }
.state.on::before { background: currentColor; animation: blink 1.4s steps(2) infinite; }
@keyframes blink { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .state.on::before { animation: none; } }

.tag { font-size: .85rem; padding: .2rem .5rem; background: var(--sun); color: #2a1f1a; border: 2px solid var(--line); white-space: nowrap; }

/* Rename and revoke open in place: no script, only <details>. */
details.act > summary { list-style: none; cursor: pointer; font: 500 1rem var(--pixel); color: var(--muted); text-decoration: underline; text-decoration-color: var(--line-soft); text-underline-offset: .3em; white-space: nowrap; }
details.act > summary::-webkit-details-marker { display: none; }
details.act > summary:hover { color: var(--ink); }
details.act.danger > summary:hover { color: #e2513a; }
details.act[open] > summary { color: var(--ink); text-decoration-color: var(--clawd); }
.drawer { grid-column: 1 / -1; display: none; margin-top: 1rem; padding: 1.25rem; background: var(--sky-wash); border: var(--b) solid var(--line); }
.drawer.danger { background: var(--clawd-wash); }
.drawer p { margin: 0 0 1rem; max-width: 46rem; }
.drawer .inline { display: flex; flex-wrap: wrap; gap: 1rem 1.25rem; align-items: flex-end; }
.drawer .inline label { flex: 1 1 16rem; }
/* The drawer is the details' sibling in the grid, so it can take the full width. */
.entry:has(details.rename[open]) .drawer.rename,
.entry:has(details.revoke[open]) .drawer.revoke,
.entry.failed .drawer.rename { display: block; }
.entry.failed details.rename > summary { color: var(--ink); }
.drawer .error { margin-bottom: 1rem; }

/* Revoked: greyed out, crossed and stamped. */
details.archive { margin-top: 1.25rem; }
details.archive > summary { cursor: pointer; list-style: none; padding: .6rem 0; color: var(--muted); font: 500 1.05rem var(--pixel); }
details.archive > summary::-webkit-details-marker { display: none; }
details.archive > summary::before { content: "▸ "; }
details.archive[open] > summary::before { content: "▾ "; }
details.archive .ledger { margin-top: .75rem; }
.entry.revoked { box-shadow: none; border-style: dashed; border-color: var(--line-soft); background: transparent; }
.entry.revoked h3 { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--clawd); text-decoration-thickness: 3px; }
.entry.revoked dd { color: var(--muted); }
.stamp {
  grid-column: 2; grid-row: 1 / span 2; align-self: center; transform: rotate(-6deg);
  font: 700 1rem/1 var(--pixel); color: #e2513a; border: var(--b) solid currentColor; padding: .45rem .7rem;
}

/* ---------- Account: one card per topic. ---------- */

.sheet-row {
  display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 1rem 2.5rem; padding: 1.75rem;
  background: var(--card); border: var(--b) solid var(--line); box-shadow: var(--shadow);
}
.sheet-row + .sheet-row { margin-top: 1.5rem; }
.sheet-row > header h2 { font-size: 1.6rem; margin-bottom: .4rem; }
.sheet-row > header p { color: var(--muted); font-size: .95rem; margin: 0; }
.sheet-row .fields { max-width: 30rem; margin-bottom: 1.5rem; }
.sheet-row .error, .sheet-row .notice { max-width: 34rem; }
.static { font: 400 .9rem var(--mono); color: var(--ink-soft); }
.static-field { display: grid; gap: .35rem; }
.fingerprint { font: 500 1.05rem/1.6 var(--mono); letter-spacing: .08em; word-spacing: .4em; }

.invites { list-style: none; margin: 2rem 0 0; padding: 0; border-top: 2px solid var(--line-soft); }
.invites li { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; align-items: baseline; padding: .8rem 0; border-bottom: 2px solid var(--line-soft); }
.invites .what { flex: 1 1 12rem; }
.invites .what em { color: var(--muted); }
.invites .status { font: 400 .8rem var(--mono); color: var(--muted); }
.invites .status.open { color: var(--grass); }
.invites form { margin-left: auto; }
.invites .by { display: block; font: 400 .72rem var(--mono); color: var(--muted); margin-top: .1rem; }

/* A ticket, for codes and invite links. */
.stub { margin: 1.5rem 0 2rem; padding: 1.25rem 1.5rem; max-width: 34rem; background: var(--sun); color: #2a1f1a; border: var(--b) dashed var(--line); }
.stub .kicker { display: block; margin-bottom: .5rem; color: #54473e; }
.stub .big-code { font: 700 clamp(2.2rem, 7vw, 3rem)/1 var(--pixel); letter-spacing: .18em; text-transform: uppercase; margin: 0; }
.stub input[readonly] { background: #fff8dc; color: #2a1f1a; }
.stub p { margin: .8rem 0 0; font-size: .95rem; }

/* Adding a field or a shepherd. */
.narrow { max-width: 38rem; }
.narrow h1 { margin-bottom: 1.25rem; }
.narrow .intro { color: var(--ink-soft); }
.narrow .facts { margin: 0 0 2rem; }
.narrow .fields { margin: 2rem 0; }
.narrow .figure { image-rendering: pixelated; margin-bottom: 1.25rem; }

.small-link { font-size: .95rem; color: var(--muted); }
.small-link:hover { color: var(--clawd); }

@media (max-width: 52rem) {
  .topbar { flex-wrap: wrap; gap: .75rem 1.5rem; }
  .app .topbar nav { order: 3; width: 100%; }
  .entry { grid-template-columns: 1fr; }
  .actions, .stamp { grid-column: 1; grid-row: auto; padding-top: .6rem; }
  .stamp { justify-self: start; }
  .sheet-row { grid-template-columns: 1fr; padding: 1.25rem; }
  .section-head p { margin: 0; width: 100%; }
}
@media (max-width: 30rem) {
  .topbar .who span { display: none; }
}
