:root {
  --bg: #f5f4f0;
  --fg: #171717;
  --muted: #69665f;
  --rule: #e0ded7;
  --hover: #ecebe6;
  --accent: #8a6a28;
  --ok: #3d7a4c;
  --bad: #b3372f;
  --neutral: #9a968d;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f0f;
    --fg: #e8e6e1;
    --muted: #8c8982;
    --rule: #232323;
    --hover: #171717;
    --accent: #c9a55a;
    --ok: #6fae7e;
    --bad: #de6a60;
    --neutral: #5d5b56;
  }
}

@view-transition {
  navigation: auto;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 1rem/1.55 var(--sans);
  padding: clamp(2.5rem, 8vw, 6rem) 16px 4rem;
}

.top,
main,
.foot {
  max-width: 60rem;
  margin-inline: auto;
}

a {
  color: inherit;
  text-decoration-color: var(--rule);
  text-underline-offset: 0.2em;
}
a:hover {
  text-decoration-color: var(--accent);
}

code {
  font: 0.85em var(--mono);
}

.handle {
  margin: 0 0 0.4rem;
  font: 0.8rem var(--mono);
  letter-spacing: 0.08em;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-weight: 300;
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.lede {
  max-width: 38rem;
  margin: 1.25rem 0 0.75rem;
  font-size: 1.15rem;
  font-weight: 300;
  text-wrap: pretty;
}

.how {
  max-width: 38rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  text-wrap: pretty;
}

/* ---------- the list ---------- */

.group {
  margin-top: 3.5rem;
}

.group h2 {
  margin: 0 0 0.5rem;
  font: 400 0.75rem var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

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

.row {
  border-bottom: 1px solid var(--rule);
}

.head {
  display: grid;
  grid-template-columns: 13rem 1fr auto;
  gap: 1.25rem;
  align-items: baseline;
  padding: 0.85rem 0.5rem;
  margin-inline: -0.5rem;
  text-decoration: none;
  border-radius: 3px;
}
.head:hover {
  background: var(--hover);
}
.head:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}

.name {
  font-weight: 500;
}
.row.open .name {
  color: var(--accent);
}

.line {
  color: var(--muted);
  text-wrap: pretty;
}

.meta {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font: 0.78rem var(--mono);
  color: var(--muted);
  white-space: nowrap;
}

.ci {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--neutral);
  align-self: center;
}
.ci[data-state="success"] {
  background: var(--ok);
}
.ci[data-state="failure"] {
  background: var(--bad);
}

.head.loading .name::after {
  content: " …";
  color: var(--muted);
}

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

/* ---------- detail (loaded on demand) ---------- */

.detail {
  padding: 0.25rem 0 2rem 14.25rem;
}
.row.open .detail {
  view-transition-name: detail;
}

.detail figure {
  margin: 0.5rem 0 1.5rem;
}
.detail img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 3px;
  background: var(--hover);
}

.idea {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  font-weight: 300;
  max-width: 36rem;
  text-wrap: pretty;
}

.summary p {
  margin: 0 0 0.8rem;
  max-width: 36rem;
  text-wrap: pretty;
}

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.3rem 1.25rem;
  margin: 1.25rem 0;
  font-size: 0.9rem;
}
.facts dt {
  font: 0.75rem/1.9 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.facts dd {
  margin: 0;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.92rem;
}

.error {
  color: var(--bad);
}

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

.foot {
  margin-top: 5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.85rem;
}
.foot p {
  margin: 0 0 0.5rem;
}

/* ---------- narrow screens ---------- */

@media (max-width: 44rem) {
  .head {
    grid-template-columns: 1fr auto;
    gap: 0.2rem 1rem;
  }
  .line {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .meta {
    grid-column: 2;
    grid-row: 1;
  }
  .detail {
    padding-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}
