/* One stylesheet for both pages: the landing page and the control panel are the
   same site, and a second theme to keep in sync would drift within a month.

   Light and dark both come from prefers-color-scheme — there's no toggle,
   because a toggle needs somewhere to remember the choice and this page has no
   session to put it in. */

:root {
  --bg: #f6f7fb;
  --bg-soft: #ffffff;
  --line: rgba(17, 24, 39, 0.08);
  --line-strong: rgba(17, 24, 39, 0.16);
  --ink: #111827;
  --ink-soft: #5b6579;
  --ink-faint: #8a93a6;
  --accent: #4f46e5;
  --accent-ink: #ffffff;
  --good: #16a34a;
  --bad: #dc2626;
  --warn: #d97706;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 12px 32px -12px rgba(16, 24, 40, 0.18);
  --radius: 16px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d13;
    --bg-soft: #141822;
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.16);
    --ink: #eef1f7;
    --ink-soft: #a5adbf;
    --ink-faint: #767f92;
    --accent: #818cf8;
    --accent-ink: #0b0d13;
    --good: #4ade80;
    --bad: #f87171;
    --warn: #fbbf24;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 40px -16px rgba(0, 0, 0, 0.7);
  }
}

* {
  box-sizing: border-box;
}

/* The whole admin page is sections toggled with the `hidden` attribute, and a
   class that sets `display` beats the browser's own `[hidden] { display: none }`
   — which shows up as every state of the page rendering at once. */
[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter,
    "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Two soft blobs behind everything. Fixed and non-interactive, so nothing on
   the page has to account for them. */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(42rem 42rem at 12% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    radial-gradient(34rem 34rem at 92% 8%, color-mix(in srgb, var(--good) 14%, transparent), transparent 62%);
  filter: blur(4px);
}

a {
  color: inherit;
}

h1,
h2 {
  margin: 0;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.wrap {
  max-width: 60rem;
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 5rem) clamp(1rem, 4vw, 2rem) 4rem;
}

.mono {
  font-family: var(--mono);
  font-size: 0.86em;
}

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

.small {
  font-size: 0.82rem;
}

/* ------------------------------------------------------------- landing --- */

.eyebrow {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero {
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}

.hero h1 {
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  font-weight: 700;
}

.lede {
  max-width: 34rem;
  margin: 0.9rem 0 0;
  font-size: 1.05rem;
  color: var(--ink-soft);
}

/* ------------------------------------------------------------ catalogue ---
   Each tile is coloured by the app it links to: home.js sets --accent and
   --accent-2 from the catalogue entry, and everything below is written in
   terms of those two. Nothing here names a specific app. */

.tiles {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 21rem), 1fr));
}

.tile {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--bg-soft);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.22s ease, box-shadow 0.22s ease;
  animation: rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--i, 0) * 80ms);
}

.tile:hover,
.tile:focus-visible {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line-strong));
  box-shadow: 0 26px 50px -26px color-mix(in srgb, var(--accent) 65%, transparent),
    var(--shadow);
}

/* The banner. With no artwork the gradient *is* the banner, which is why an app
   nobody has drawn an icon for still looks deliberate. */
.tile-art {
  position: relative;
  aspect-ratio: 16 / 7;
  overflow: hidden;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.tile-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.tile:hover .tile-art img {
  transform: scale(1.035);
}

.tile-body {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.7rem;
  padding: 2.9rem 1.4rem 1.3rem;
}

/* Straddles the seam between the artwork and the body, punched out of the
   banner by a border in the card's own colour. */
.tile-chip {
  position: absolute;
  top: 0;
  left: 1.4rem;
  display: grid;
  place-items: center;
  width: 4rem;
  height: 4rem;
  border: 4px solid var(--bg-soft);
  border-radius: 20px;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  box-shadow: 0 12px 24px -12px color-mix(in srgb, var(--accent) 75%, transparent);
  transform: translateY(-50%);
}

.tile-chip img {
  width: 56%;
  height: 56%;
}

.tile-chip-text {
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.tile-title {
  font-size: clamp(1.4rem, 2.4vw, 1.75rem);
  font-weight: 700;
}

/* FONT= in a catalogue entry picks one of these. Stacks of what the reader
   already has — the page loads nothing off-origin, fonts included. */
.tile[data-font="serif"] .tile-title {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  letter-spacing: -0.005em;
}

.tile[data-font="rounded"] .tile-title {
  font-family: ui-rounded, "SF Pro Rounded", "Avenir Next", Avenir, "Segoe UI",
    system-ui, sans-serif;
  letter-spacing: -0.01em;
}

.tile[data-font="mono"] .tile-title {
  font-family: var(--mono);
  font-size: clamp(1.2rem, 2vw, 1.45rem);
  letter-spacing: -0.03em;
}

.tile[data-font="display"] .tile-title {
  font-weight: 800;
  letter-spacing: -0.035em;
}

.tile-tagline {
  margin: 0.15rem 0 0;
  font-size: 0.92rem;
  font-weight: 500;
  /* Mixed with the ink rather than used raw, so a pale accent stays legible in
     light mode and a dark one in dark mode. */
  color: color-mix(in srgb, var(--accent) 68%, var(--ink));
}

.tile-blurb {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.tile-go {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: auto;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.tile-host {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--ink-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile:hover .arrow {
  transform: translateX(4px);
  opacity: 1;
  color: color-mix(in srgb, var(--accent) 70%, var(--ink));
}

.tile.skeleton {
  min-height: 21rem;
  border-style: dashed;
  box-shadow: none;
  opacity: 0.45;
  animation: pulse 1.6s ease-in-out infinite;
}

.mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 12px;
  background: linear-gradient(140deg, var(--accent), color-mix(in srgb, var(--accent) 40%, var(--good)));
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

.mark.small {
  width: 2rem;
  height: 2rem;
  border-radius: 9px;
  font-size: 0.72rem;
}

.arrow {
  opacity: 0.4;
  transition: transform 0.2s ease, opacity 0.2s ease, color 0.2s ease;
}

.empty {
  margin-top: 1.5rem;
  color: var(--ink-soft);
}

.foot {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
}

.foot a {
  color: var(--ink-soft);
  text-decoration: none;
}

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

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

.gate {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.panel {
  margin-bottom: 1.25rem;
  padding: 1.25rem clamp(1rem, 3vw, 1.5rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--bg-soft) 92%, transparent);
  box-shadow: var(--shadow);
}

.panel.signin {
  max-width: 25rem;
  text-align: center;
}

.panel.signin h1 {
  font-size: 1.5rem;
}

.panel.signin .muted {
  margin: 0.75rem 0 1.25rem;
  font-size: 0.94rem;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.panel-head h2 {
  font-size: 1.05rem;
}

.head-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.bar h1 {
  font-size: 1.6rem;
}

.who {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
}

.who-email {
  display: block;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rows {
  display: flex;
  flex-direction: column;
}

.row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
}

.row:first-child {
  border-top: 0;
}

.row.compact {
  padding: 0.6rem 0;
}

.row-main {
  flex: 1;
  min-width: 0;
}

.row-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.2rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

/* A commit subject is as long as whoever wrote it felt like. Clipped so the
   line it's on stays one line — the full text is on the element's title. */
.row-meta .clip {
  max-width: 42ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-meta a {
  text-decoration: none;
}

.row-meta a:hover {
  text-decoration: underline;
}

.row-error {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--bad);
}

/* Sits under the app rows, describing the checkout they were all judged by.
   Separated by a rule so it doesn't read as another row. */
.ops-tree {
  margin: 0.9rem 0 0;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-faint);
  overflow-wrap: anywhere;
}

/* The controls at the end of an app row. Grouped so the row has one thing on
   its right rather than two competing for the space the app's name needs. */
.row-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

/* The auto-deploy switch. A real checkbox, kept where a screen reader and the
   keyboard can find it, with the track drawn next to it — `appearance: none` on
   the input itself would take the focus ring with it. */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.switch .track {
  position: relative;
  flex: none;
  width: 2.1rem;
  height: 1.2rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.switch .track::after {
  content: "";
  position: absolute;
  top: 0.15rem;
  left: 0.18rem;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background: var(--bg-soft);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.35);
  transition: transform 0.15s ease;
}

.switch input:checked + .track {
  border-color: transparent;
  background: var(--accent);
}

.switch input:checked + .track::after {
  transform: translateX(0.85rem);
}

.switch input:focus-visible + .track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.switch-text {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
}

.switch input:checked ~ .switch-text {
  color: var(--ink-soft);
}

.switch:has(input:disabled) {
  opacity: 0.45;
  cursor: not-allowed;
}

.dot {
  flex: none;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--ink-faint);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ink-faint) 18%, transparent);
}

.dot.up {
  background: var(--good);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 20%, transparent);
}

.dot.down {
  background: var(--bad);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--bad) 20%, transparent);
}

.badge {
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  text-transform: lowercase;
}

.badge.good {
  border-color: color-mix(in srgb, var(--good) 40%, transparent);
  color: var(--good);
}

.badge.bad {
  border-color: color-mix(in srgb, var(--bad) 40%, transparent);
  color: var(--bad);
}

.badge.warn {
  border-color: color-mix(in srgb, var(--warn) 45%, transparent);
  background: color-mix(in srgb, var(--warn) 12%, transparent);
  color: var(--warn);
}

.badge.quiet {
  opacity: 0.7;
}

.button {
  flex: none;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.button:hover:not(:disabled) {
  border-color: var(--accent);
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.button.primary {
  display: inline-block;
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.6rem 1.2rem;
}

.button.ghost {
  background: transparent;
  border-color: var(--line);
  font-weight: 500;
  color: var(--ink-soft);
}

.notice {
  margin: 0 0 1.25rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--warn) 10%, transparent);
  font-size: 0.88rem;
}

.notice.bad {
  border-color: color-mix(in srgb, var(--bad) 35%, transparent);
  background: color-mix(in srgb, var(--bad) 10%, transparent);
}

.log {
  max-height: 22rem;
  margin: 0;
  padding: 0.9rem 1rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.fineprint {
  margin: 1.25rem 0 0;
  font-size: 0.85rem;
}

.fineprint a {
  color: var(--ink-soft);
  text-decoration: none;
}

/* ----------------------------------------------------------- one site --- */

/* The app name in a row, which is the way in to that app's own page. Looks like
   the heading it replaced until you're over it — the row is not a link, and
   only this part of it navigates. */
.row-link {
  color: inherit;
  text-decoration: none;
}

.row-link:hover,
.row-link:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.tab {
  padding: 0.35rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

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

.tab.on {
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: color-mix(in srgb, var(--accent) 75%, var(--ink));
}

/* A feedback message, as written. Wrapped rather than clipped: the whole point
   of the tab is to read it. */
.message {
  margin: 0.5rem 0 0;
  padding: 0.6rem 0.8rem;
  border-left: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--ink) 4%, transparent);
  border-radius: 0 10px 10px 0;
  font-size: 0.92rem;
  white-space: pre-wrap;
  word-break: break-word;
}

/* --------------------------------------------------------- the form ----- */

.wrap.narrow {
  max-width: 40rem;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.88rem;
  font-weight: 600;
}

.field em {
  font-style: normal;
  font-weight: 400;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--ink);
  font: inherit;
  font-weight: 400;
}

.field textarea {
  resize: vertical;
  min-height: 7rem;
}

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.form-go {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.9rem;
}

.form-go .fineprint {
  flex: 1;
  min-width: 14rem;
  margin: 0;
}

/* The honeypot. Off-screen rather than display:none — a bot that skips hidden
   fields is a bot that skips this one, and the point is that it doesn't.
   Nothing focusable reaches it: it's tabindex=-1 and aria-hidden. */
.trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes pulse {
  50% {
    opacity: 0.25;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
