/* Kestrel. A small falcon that hovers over one field and watches for anything that moves.
   Palette from the bird: slate-blue head, chestnut back with dark spotting, a dusk sky behind it.
   Signature element: the "watch line" on each job, a field of past runs as plumage spots with the next run hovering above. */
:root {
  --dusk: #1a2130;        /* page */
  --dusk-2: #212a3b;      /* panels */
  --dusk-3: #2a3548;      /* inputs, raised */
  --rule: #354258;
  --bone: #ece6da;        /* main text */
  --mist: #a3acbd;        /* secondary text */
  --chestnut: #c06a32;    /* kestrel back: primary action, "changed" */
  --chestnut-ink: #1a1208;
  --slate: #7f98bd;       /* kestrel head: links, "unchanged" */
  --lichen: #9cc27f;      /* ok */
  --rust-red: #e46a5c;    /* failed */
  --ochre: #e0b04e;       /* partial / running */
  --radius-lg: 14px;
  --radius-sm: 7px;
  --f: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body { margin: 0; background: var(--dusk); color: var(--bone); font: 400 15.5px/1.55 var(--f); font-variant-numeric: tabular-nums; }
a { color: var(--slate); text-underline-offset: 3px; }
a:hover { color: var(--bone); }
:focus-visible { outline: 2px solid var(--chestnut); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-stretch: 75%; font-weight: 800; letter-spacing: -.01em; line-height: 1.1; margin: 0; }
h1 { font-size: clamp(30px, 5vw, 44px); }
h2 { font-size: 24px; }
h3 { font-size: 18px; font-weight: 700; }
p { margin: 0 0 10px; max-width: 70ch; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px 64px; }
.muted { color: var(--mist); }
.small { font-size: 13.5px; }
.nowrap { white-space: nowrap; }
.code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; }

/* top bar */
.bar { display: flex; align-items: center; gap: 16px; padding: 14px 16px; max-width: 1120px; margin: 0 auto; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--bone); text-decoration: none; font-weight: 800; font-stretch: 75%; font-size: 24px; letter-spacing: -.01em; }
.brand svg { width: 34px; height: 34px; }
.bar nav { display: flex; gap: 6px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.bar nav a { color: var(--mist); text-decoration: none; padding: 6px 10px; border-radius: var(--radius-sm); }
.bar nav a:hover, .bar nav a[aria-current="page"] { color: var(--bone); background: var(--dusk-2); }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--rule); background: var(--dusk-3); color: var(--bone);
  font: 600 14.5px/1 var(--f); padding: 9px 14px; border-radius: var(--radius-sm); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--mist); color: var(--bone); }
.btn.primary { background: var(--chestnut); border-color: var(--chestnut); color: var(--chestnut-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--rust-red); }
.btn.sm { padding: 6px 10px; font-size: 13.5px; }
form.inline { display: inline; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* flash */
.flash { margin: 6px 0 16px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--dusk-2); border-left: 3px solid var(--lichen); }
.flash.bad { border-left-color: var(--rust-red); }
.errors { background: #3a2222; border: 1px solid var(--rust-red); border-radius: var(--radius-sm); padding: 10px 14px 10px 32px; margin: 0 0 16px; }

/* page head */
.head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 18px 0 22px; }
.head .grow { flex: 1; min-width: 240px; }

/* job list */
.jobs { display: grid; gap: 14px; }
.job { display: grid; grid-template-columns: 220px 1fr; gap: 18px; background: var(--dusk-2); border: 1px solid var(--rule);
  border-radius: var(--radius-lg); padding: 14px; }
.job.paused { opacity: .7; }
.shot { display: block; aspect-ratio: 4 / 3; border-radius: var(--radius-sm); overflow: hidden; background: var(--dusk-3); border: 1px solid var(--rule); }
.shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.shot.empty { display: grid; place-items: center; color: var(--mist); font-size: 13px; text-align: center; padding: 10px; }
.job h2 a { color: var(--bone); text-decoration: none; }
.job h2 a:hover { text-decoration: underline; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--mist); font-size: 13.5px; margin: 4px 0 10px; }
.urls { margin: 0 0 10px; padding: 0; list-style: none; font-size: 13.5px; }
.urls li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--mist); }

/* the watch line: past runs as plumage spots, the next run hovering at the end */
.watch { position: relative; height: 34px; margin: 6px 0 12px; display: flex; align-items: flex-end; gap: 7px; padding-right: 76px; }
.watch::before { content: ""; position: absolute; left: 0; right: 0; bottom: 6px; height: 1px; background: var(--rule); }
.spot { position: relative; z-index: 1; width: 11px; height: 11px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--slate); }
.spot.changed { background: var(--chestnut); }
.spot.ok { background: var(--lichen); }
.spot.unchanged { background: var(--slate); opacity: .65; }
.spot.failed { background: var(--rust-red); border-radius: 2px; transform: none; }
.spot.partial { background: var(--ochre); }
.spot.running, .spot.queued { background: var(--ochre); animation: hover 1.6s ease-in-out infinite; }
.watch .next { position: absolute; right: 0; bottom: 14px; font-size: 12.5px; color: var(--mist); display: flex; align-items: center; gap: 6px; }
.watch .next svg { width: 22px; height: 12px; color: var(--chestnut); animation: hover 2.4s ease-in-out infinite; }
@keyframes hover { 0%, 100% { translate: 0 0; } 50% { translate: 0 -3px; } }
@media (prefers-reduced-motion: reduce) { .spot.running, .spot.queued, .watch .next svg { animation: none; } }

.status { display: inline-block; font-size: 12.5px; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: var(--dusk-3); color: var(--mist); }
.status.ok { background: #263a26; color: var(--lichen); }
.status.changed { background: #3d2818; color: #f0a46e; }
.status.unchanged { background: #232f43; color: var(--slate); }
.status.failed { background: #3d2220; color: var(--rust-red); }
.status.partial, .status.running, .status.queued { background: #3a321c; color: var(--ochre); }

.empty-state { border: 1px dashed var(--rule); border-radius: var(--radius-lg); padding: 36px 24px; text-align: center; }
.empty-state p { margin: 8px auto 18px; }

/* forms */
.panel { background: var(--dusk-2); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: 18px; margin-bottom: 16px; }
.panel > h2 { font-size: 20px; margin-bottom: 4px; }
.panel > .muted { margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; }
label.f { display: grid; gap: 5px; font-weight: 600; font-size: 14px; }
label.f .hint { font-weight: 400; color: var(--mist); font-size: 12.5px; }
input[type=text], input[type=url], input[type=email], input[type=password], input[type=number], input[type=time], select, textarea {
  width: 100%; background: var(--dusk-3); color: var(--bone); border: 1px solid var(--rule); border-radius: var(--radius-sm);
  padding: 9px 10px; font: 400 15px var(--f); }
textarea { min-height: 70px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #7a8497; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--chestnut); }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--radius-sm); overflow: hidden; }
.seg label { padding: 8px 12px; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--mist); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg input:checked + span { color: var(--chestnut-ink); }
.seg label:has(input:checked) { background: var(--chestnut); color: var(--chestnut-ink); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--bone); outline-offset: -3px; }

.target { border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 12px; background: #1d2534; }
.target .top { display: grid; grid-template-columns: 1fr 220px auto; gap: 10px; align-items: end; }
.target details { margin-top: 10px; }
.target summary { cursor: pointer; color: var(--slate); font-weight: 600; font-size: 14px; }
.target details .grid2 { margin-top: 12px; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--dusk) 30%); padding: 18px 0 10px; display: flex; gap: 10px; flex-wrap: wrap; }

/* job page */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--rule); margin: 8px 0 16px; }
.tabs a { padding: 8px 12px; color: var(--mist); text-decoration: none; border-bottom: 2px solid transparent; font-weight: 600; }
.tabs a[aria-current="true"] { color: var(--bone); border-bottom-color: var(--chestnut); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.tile { background: var(--dusk-2); border: 1px solid var(--rule); border-radius: var(--radius-sm); overflow: hidden; }
.tile .shot { border: 0; border-radius: 0; }
.tile .cap { padding: 8px 10px; font-size: 13px; display: grid; gap: 4px; }
.tile.sel { outline: 2px solid var(--chestnut); }
table.log { width: 100%; border-collapse: collapse; font-size: 14px; }
table.log th { text-align: left; color: var(--mist); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--rule); }
table.log td { padding: 8px; border-bottom: 1px solid #283247; vertical-align: top; }
.err { color: #f2a59c; font-size: 13px; }
pre.log { white-space: pre-wrap; background: var(--dusk-3); padding: 12px; border-radius: var(--radius-sm); font-size: 13px; }

/* compare */
.cmp { position: relative; overflow: hidden; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: #fff; }
.cmp img { display: block; width: 100%; }
.cmp .after { position: absolute; inset: 0; overflow: hidden; width: 50%; border-right: 2px solid var(--chestnut); }
.cmp .after img { width: auto; height: 100%; max-width: none; }
.side { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.side img { width: 100%; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: #fff; }

/* login */
.login { max-width: 380px; margin: 12vh auto 0; padding: 0 16px; }
.login .brand { font-size: 34px; margin-bottom: 18px; }
.login .brand svg { width: 46px; height: 46px; }

footer { color: var(--mist); font-size: 12.5px; text-align: center; padding: 24px 16px; }

@media (max-width: 720px) {
  .job { grid-template-columns: 1fr; }
  .target .top { grid-template-columns: 1fr; }
  .side { grid-template-columns: 1fr; }
}

/* Installed app (Add to Home Screen): keep content clear of the phone's status bar and home bar. */
@media (display-mode: standalone) {
  body { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
}
