/* ---------- Tokens (shared by every page) ---------- */
:root {
  --white: #ffffff;
  --black: #000000;
  --red: #e3170a;
  --red-deep: #a80f05;   /* top of the leader's bar */
  --grey: #5e5e5e;
  --line: #e6e6e6;
  --surface: #f3f4f6;    /* photo placeholders */
  --ease-out: cubic-bezier(.2, .8, .2, 1);

  --font: "Arial", system-ui, -apple-system, "Segoe UI", sans-serif;
  --wide: 125;      /* font-stretch % for display type */
  --radius: 6px;
  --gutter: 1rem;
}

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--black);
  background: var(--white);
}

img { max-width: 100%; display: block; }
a { color: var(--black); text-underline-offset: 3px; }
a:hover { color: var(--red); }

h1, h2, h3 {
  margin: 0 0 0.5em;
  font-stretch: 125%;
  font-weight: 850;
  line-height: 1.05;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(2.4rem, 7vw, 4.75rem); }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.25rem); }
h3 { font-size: 1.15rem; font-weight: 750; line-height: 1.2; }
p { margin: 0 0 1rem; max-width: 62ch; }
.muted { color: var(--grey); }

:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }

.container { width: min(1160px, 100% - 2 * var(--gutter)); margin-inline: auto; }
.section { padding-block: clamp(3rem, 8vw, 5.5rem); }
.section + .section { padding-top: 0; } /* stacked sections share one gap, not two */
/* Home leaderboard: no rule above it, less space on top, and the bars sit
   right on the "Recent cleanups" divider below (that line is their baseline) */
.leaderboard-section { padding-top: clamp(1.5rem, 4vw, 2.5rem); padding-bottom: 0; }
.leaderboard-section .section-head { border-top: 0; padding-top: 0; margin-bottom: clamp(1.5rem, 4vw, 2.5rem); }
.leaderboard-section h2 {
  font-size: clamp(2.25rem, 6vw, 4.25rem);
  letter-spacing: -0.025em; line-height: 0.98; text-wrap: balance;
}
[hidden] { display: none !important; }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--black); color: var(--white); padding: 0.5rem 1rem;
}
.skip-link:focus { left: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px;
  padding: 0.7rem 1.35rem;
  border: 2px solid var(--black);
  border-radius: var(--radius);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--black); color: var(--white); }
.btn-primary:hover { background: var(--red); border-color: var(--red); color: var(--white); }
.btn-ghost { background: var(--white); color: var(--black); }
.btn-ghost:hover { border-color: var(--red); color: var(--red); }
.btn-invert { background: var(--white); color: var(--black); border-color: var(--white); }
.btn-invert:hover { background: var(--red); border-color: var(--red); color: var(--white); }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgb(255 255 255 / 0.86);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0.5rem 2rem; padding-block: 0.8rem;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-stretch: 125%; font-weight: 850; font-size: 1.15rem;
  text-decoration: none; color: var(--black);
}
.brand-mark { width: 1.35em; height: 1.35em; fill: var(--red); flex: none; }
.nav-links {
  display: flex; flex-wrap: wrap; gap: 1.5rem;
  list-style: none; margin: 0; padding: 0; flex: 1;
}
.nav-links a {
  position: relative; display: inline-block; padding-block: 0.35rem;
  text-decoration: none; font-weight: 600; color: #444;
  transition: color 160ms ease;
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--black); }
/* Red underline: always on the current page, slides in on hover elsewhere */
.nav-links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 3px;
  border-radius: 2px; background: var(--red);
  transform: scaleX(0); transform-origin: left;
  transition: transform 220ms var(--ease-out);
}
.nav-links a:hover::after, .nav-links a[aria-current="page"]::after { transform: scaleX(1); }
.nav-auth { display: flex; align-items: center; gap: 0.75rem; }
.nav-auth .btn { min-height: 40px; padding: 0.4rem 1rem; }
/* After Google sign-in: a label, not a link */
.btn.is-signed-in, .btn.is-signed-in:hover { cursor: default; border-color: var(--black); color: var(--black); }
.btn.is-signed-in::before {
  content: ""; flex: none; width: 0.5rem; height: 0.5rem; margin-right: 0.5rem;
  border-radius: 50%; background: var(--red);
}
.btn.is-signed-in .auth-name {
  margin-left: 0.5rem; padding-left: 0.5rem; border-left: 1px solid var(--line);
  font-weight: 750; max-width: 14ch;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Phones: just the red dot and the name, so it fits beside the logo */
@media (max-width: 699px) {
  .btn.is-signed-in .auth-label { display: none; }
  .btn.is-signed-in .auth-name { margin-left: 0; padding-left: 0; border-left: 0; max-width: none; min-width: 0; }
  /* Let the button take whatever room is left beside the logo; long names get "…" */
  .nav-auth { flex: 1 1 0; min-width: 0; justify-content: flex-end; }
  .nav-auth .btn.is-signed-in { min-width: 0; max-width: 100%; padding-inline: 0.6rem; }
}
.user-name { font-weight: 700; }

/* Small screens: logo + sign-in on row one, links on row two */
@media (max-width: 699px) {
  .nav { justify-content: space-between; gap: 0.25rem 1rem; padding-block: 0.6rem 0; }
  .brand { font-size: 1rem; white-space: nowrap; }
  .brand-logo { width: 32px; height: 32px; }
  .nav-auth .btn { min-height: 36px; padding: 0.3rem 0.8rem; }
  .nav-links { order: 3; flex-basis: 100%; gap: 1.25rem; }
  .nav-links a { padding-block: 0.5rem; }
  .user-name { display: none; }
}

/* ---------- Intro ---------- */
.intro { padding-block: clamp(3rem, 9vw, 6rem) clamp(1rem, 3vw, 2rem); }
.intro h1 { max-width: 16ch; }
.lead { font-size: 1.2rem; color: var(--grey); max-width: 58ch; margin-bottom: 0; }

/* Staircase leaderboard: the signature element */
.stairs {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: row-reverse; /* rank 1 sits highest, on the right */
  align-items: flex-end; gap: clamp(0.75rem, 4vw, 3.5rem);
  height: clamp(260px, 36vw, 380px);
  padding-inline: clamp(0rem, 2vw, 1.5rem);
  /* faint chart grid: one line every quarter of the height */
  background-image: linear-gradient(to bottom, #ededed 1px, transparent 1px);
  background-size: 100% 25%;
  animation: fade-in 600ms ease both;
}
.step {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  height: 100%;
}
.step-label {
  width: 100%; padding-bottom: 0.6rem; line-height: 1.2; text-align: center;
  animation: label-in 450ms var(--ease-out) both;
}
.step-name {
  display: block; font-weight: 750;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.step-points { display: block; font-size: 0.85rem; color: var(--grey); font-variant-numeric: tabular-nums; }
.step-bar {
  height: var(--h, 20%);
  width: min(100%, 5.5rem); /* skinny bars */
  background: linear-gradient(to top, var(--white), var(--red)); /* white at the bottom, red at the top */
  color: var(--white);
  border-radius: 10px 10px 0 0;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 0.6rem;
  font-stretch: 125%; font-weight: 850; font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
  transform-origin: bottom;
  animation: rise 800ms var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 90ms);
}
/* The leader: deeper red at the top, a soft red glow, and a bolder label */
.step.is-leader .step-bar {
  background: linear-gradient(to top, var(--white), var(--red) 62%, var(--red-deep));
  box-shadow: 0 -12px 32px -12px rgb(227 23 10 / 0.55);
}
.step.is-leader .step-name { font-size: 1.15rem; }
.step.is-leader .step-points { color: var(--red); font-weight: 700; }
.stairs-status { align-self: center; color: var(--grey); width: 100%; }

/* One load sequence: bars rise from rank 5 up to rank 1, then each name appears
   just as its bar lands. (List order is rank 1 first, so child 5 goes first.) */
.step:nth-child(5) .step-label { animation-delay: 420ms; }
.step:nth-child(4) .step-label { animation-delay: 510ms; }
.step:nth-child(3) .step-label { animation-delay: 600ms; }
.step:nth-child(2) .step-label { animation-delay: 690ms; }
.step:nth-child(1) .step-label { animation-delay: 780ms; }

@keyframes rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes label-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .stairs, .step-bar, .step-label { animation: none; }
}

/* ---------- How it works ---------- */
.how { border-top: 2px solid var(--black); }
.steps {
  list-style: none; margin: 2rem 0 0; padding: 0;
  display: grid; gap: 2rem;
}
@media (min-width: 760px) { .steps { grid-template-columns: repeat(3, 1fr); gap: 0; } }
.steps li { padding-top: 1rem; border-top: 1px solid var(--line); }
@media (min-width: 760px) {
  .steps li { padding: 0 2rem 0 0; border-top: 0; }
  .steps li + li { padding-left: 2rem; border-left: 1px solid var(--line); }
}
.step-num {
  display: block; margin-bottom: 0.75rem;
  font-stretch: 125%; font-weight: 900; font-size: 3rem; line-height: 1;
}
.steps p { color: var(--grey); }

/* ---------- Recent cleanups ---------- */
.section-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline;
  gap: 0.5rem 1rem; margin-bottom: 1.5rem;
  padding-top: 1rem; border-top: 2px solid var(--black);
}
.section-head h2 { margin: 0; }
.section-head a { font-weight: 600; }

.submissions {
  display: grid; gap: 2.5rem 1.75rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}
.sub-card { margin: 0; }
.ba-pair {
  display: grid; grid-template-columns: 1fr 1fr; gap: 3px;
  border-radius: 12px; overflow: hidden; /* one rounded frame around both photos */
  isolation: isolate;
}
.ba-pair figure { margin: 0; position: relative; overflow: hidden; }
.ba-pair img, .ba-placeholder {
  width: 100%; aspect-ratio: 4 / 5; object-fit: cover;
  background: var(--surface);
}
.ba-placeholder { display: grid; place-items: center; color: #9a9ca3; font-size: 0.85rem; }
.ba-pair figcaption {
  position: absolute; left: 10px; bottom: 10px;
  background: rgb(0 0 0 / 0.78); color: var(--white);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.01em;
  padding: 0.2rem 0.6rem; border-radius: 999px;
}
.ba-pair figure:last-child figcaption { background: var(--red); }
.sub-meta {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  margin: 0.85rem 0 0; font-size: 0.95rem; color: var(--grey);
  font-variant-numeric: tabular-nums;
}
.sub-meta strong { color: var(--black); font-weight: 750; }

/* ---------- Closing call to action ---------- */
.cta {
  position: relative; overflow: hidden;
  background: var(--black); color: var(--white);
  padding-block: clamp(3.5rem, 9vw, 6rem);
}
/* Background staircase (the "Ascension" motif): five overlapping blocks
   anchored bottom-right, each narrower and taller than the last */
.cta::before {
  content: ""; position: absolute; right: 0; bottom: 0;
  width: min(48%, 560px); height: 100%;
  --s: rgb(255 255 255 / 0.05);
  background:
    linear-gradient(var(--s), var(--s)) right bottom / 100% 20% no-repeat,
    linear-gradient(var(--s), var(--s)) right bottom / 80% 40% no-repeat,
    linear-gradient(var(--s), var(--s)) right bottom / 60% 60% no-repeat,
    linear-gradient(var(--s), var(--s)) right bottom / 40% 80% no-repeat,
    linear-gradient(rgb(227 23 10 / 0.5), rgb(227 23 10 / 0.08)) right bottom / 20% 100% no-repeat;
  pointer-events: none;
}
.cta-inner { position: relative; display: grid; justify-items: start; gap: 0.25rem; }
.cta h2 { margin-bottom: 0.5rem; font-size: clamp(2rem, 4.5vw, 3.25rem); letter-spacing: -0.02em; }
.cta p { color: #bdbdbd; margin-bottom: 1.75rem; font-size: 1.1rem; }
.cta .btn-invert { background: var(--red); border-color: var(--red); color: var(--white); }
.cta .btn-invert:hover { background: var(--white); border-color: var(--white); color: var(--black); }
@media (max-width: 699px) { .cta::before { width: 70%; opacity: 0.6; } }

/* ---------- Footer ---------- */
.site-footer { padding-block: 1.75rem; color: var(--grey); font-size: 0.95rem; border-top: 1px solid var(--line); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem 2rem; }
.footer-inner p { margin: 0; }
.brand-small { font-size: 1rem; }

/* ---------- Submit page ---------- */
.submit-page { max-width: 760px; padding-block: clamp(2.5rem, 7vw, 4.5rem); }
.page-title { font-size: clamp(2rem, 5vw, 3rem); }
.submit-page .lead { margin-bottom: 2.5rem; }

.submit-form { display: grid; gap: 1.75rem; }
.field { display: grid; gap: 0.4rem; }
.field-label { font-weight: 700; padding: 0; }
.field-hint { margin: 0; font-size: 0.9rem; color: var(--grey); }

.submit-form textarea,
.submit-form input[type="text"],
.submit-form input[type="date"] {
  width: 100%;
  font: inherit;
  color: var(--black);
  background: var(--white);
  border: 2px solid var(--black);
  border-radius: var(--radius);
  padding: 0.7rem 0.85rem;
}
.submit-form textarea { resize: vertical; min-height: 7rem; }
.submit-form textarea::placeholder,
.submit-form input[type="text"]::placeholder { color: #8a8a8a; }
.field-date input[type="date"] { max-width: 16rem; min-height: 48px; }
.field-name input[type="text"] { max-width: 24rem; min-height: 48px; }
.submit-form textarea:focus-visible,
.submit-form input[type="text"]:focus-visible,
.submit-form input[type="date"]:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }

/* Before / after upload tiles */
.photo-fields {
  border: 0; margin: 0; padding: 0; min-width: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem;
}
.photo-fields legend { margin-bottom: 0.5rem; }
.photo-drop {
  position: relative;
  display: flex; flex-direction: column; justify-content: space-between; gap: 1rem;
  aspect-ratio: 1 / 1;
  padding: 2.75rem 1rem 1rem;
  background: #f2f2f2;
  border: 2px dashed var(--black);
  border-radius: var(--radius);
  cursor: pointer;
}
.photo-drop:hover { border-color: var(--red); }
.photo-drop:focus-within { outline: 3px solid var(--red); outline-offset: 2px; }
.photo-tag {
  position: absolute; left: 0.75rem; top: 0.75rem;
  background: var(--black); color: var(--white);
  font-size: 0.8rem; font-weight: 700;
  padding: 0.15rem 0.5rem; border-radius: 3px;
}
.photo-tag-after { background: var(--red); }
.photo-prompt { display: grid; gap: 0.25rem; margin-top: auto; margin-bottom: auto; text-align: center; }
.photo-prompt span { font-size: 0.9rem; color: var(--grey); }
.photo-drop input[type="file"] { width: 100%; font: inherit; font-size: 0.85rem; color: var(--grey); }
.photo-drop input[type="file"]:focus-visible { outline: none; } /* tile shows focus instead */
.photo-drop input[type="file"]::file-selector-button {
  font: inherit; font-weight: 700;
  margin-right: 0.6rem; padding: 0.4rem 0.8rem;
  background: var(--white); color: var(--black);
  border: 2px solid var(--black); border-radius: var(--radius);
  cursor: pointer;
}

.submit-btn { justify-self: start; min-width: 12rem; }

@media (max-width: 480px) {
  .photo-fields { grid-template-columns: 1fr; }
  .photo-drop { aspect-ratio: 4 / 3; }
  .submit-btn { justify-self: stretch; }
}

/* Photo preview (shown once a file is chosen).
   The image fills the space above the file bar; the bar sits below it, not on top. */
.photo-preview {
  flex: 1 1 0; min-height: 0; height: 0; /* fill leftover space; never stretch the tile */
  width: 100%; object-fit: cover;
  border-radius: calc(var(--radius) - 2px) calc(var(--radius) - 2px) 0 0;
}
.photo-drop .photo-tag { z-index: 1; }
.photo-drop.has-image { border-style: solid; padding: 0; gap: 0; }
.photo-drop.has-image .photo-prompt { display: none; }
.photo-drop.has-image input[type="file"] {
  flex: none;
  background: var(--white); color: var(--black);
  padding: 0.6rem 0.75rem;
  border-top: 2px solid var(--black);
  border-radius: 0 0 calc(var(--radius) - 2px) calc(var(--radius) - 2px);
}

/* ---------- Posts page ---------- */
.posts-page { padding-block: clamp(2.5rem, 7vw, 4.5rem); }
.posts-page .lead { margin-bottom: 2.5rem; }
.post-grid {
  display: grid; gap: 2.5rem 1.5rem;
  grid-template-columns: 1fr;
}
@media (min-width: 600px) { .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .post-grid { grid-template-columns: repeat(3, 1fr); } }
.post { display: flex; flex-direction: column; }
.post-desc { margin: 0.75rem 0 0; font-size: 0.98rem; line-height: 1.45; }
.post .sub-meta { margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--line); }

/* ---------- Sign-in state (set <body data-auth="in"> when signed in) ---------- */
body:not([data-auth="in"]) .auth-in-only { display: none !important; }
body[data-auth="in"] .auth-out-only { display: none !important; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Likes + comments on posts ---------- */
.post-social { margin-top: 0.6rem; }

.like-btn {
  float: left;
  display: inline-flex; align-items: center; gap: 0.35rem;
  min-height: 36px; padding: 0.25rem 0.7rem 0.25rem 0.55rem;
  font: inherit; font-weight: 700; font-size: 0.95rem;
  color: var(--black); background: var(--white);
  border: 2px solid var(--black); border-radius: 999px;
  text-decoration: none; cursor: pointer;
}
.like-btn:hover { border-color: var(--red); color: var(--black); }
.like-icon { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 2; }
.like-btn[aria-pressed="true"] { border-color: var(--red); }
.like-btn[aria-pressed="true"] .like-icon { fill: var(--red); stroke: var(--red); }
.like-count { font-variant-numeric: tabular-nums; }

.comments > summary {
  display: block; list-style: none;
  min-height: 36px; line-height: 36px; text-align: right;
  font-weight: 600; font-size: 0.95rem; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}
.comments > summary::-webkit-details-marker { display: none; }
.comments > summary:hover { color: var(--red); }
.comments > summary::after { content: " +"; }
.comments[open] > summary::after { content: " \2212"; }

.comments-body {
  clear: both;
  margin-top: 0.75rem; padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  display: grid; gap: 0.9rem;
}
.comment-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.8rem; }
.comment-meta { display: flex; gap: 0.6rem; align-items: baseline; margin: 0; font-size: 0.9rem; }
.comment-meta time { color: var(--grey); }
.comment-text { margin: 0.15rem 0 0; font-size: 0.95rem; line-height: 1.45; }
.comment-empty { margin: 0; color: var(--grey); font-size: 0.95rem; }

.comment-form { display: grid; gap: 0.5rem; }
.comment-form textarea {
  width: 100%; font: inherit; font-size: 0.95rem;
  padding: 0.55rem 0.7rem; resize: vertical;
  border: 2px solid var(--black); border-radius: var(--radius);
}
.comment-form textarea:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.comment-form .btn { justify-self: start; min-height: 40px; padding: 0.4rem 1rem; }
.comment-signin { margin: 0; font-size: 0.95rem; }
.comment-signin a { font-weight: 700; }

/* ---------- Role (set <body data-role="admin"> for admins) ---------- */
body:not([data-role="admin"]) .admin-only { display: none !important; }

/* ---------- Tasks page ---------- */
.tasks-page { max-width: 960px; padding-block: clamp(2.5rem, 7vw, 4.5rem); }
.tasks-page .lead { margin-bottom: 2rem; }

/* Assign form (admins) */
.assign-task { margin-bottom: 2.5rem; }
.assign-task > summary { list-style: none; display: inline-flex; }
.assign-task > summary::-webkit-details-marker { display: none; }
.assign-task[open] > summary { background: var(--white); color: var(--black); }
.task-form {
  margin-top: 1rem; padding: 1.25rem;
  border: 2px solid var(--black); border-radius: var(--radius);
}
.task-form-row { display: grid; gap: 1rem; }
@media (min-width: 700px) { .task-form-row { grid-template-columns: 1fr 1fr auto 6.5rem; } }
.task-form input[type="text"],
.task-form input[type="number"] {
  width: 100%; min-height: 48px; font: inherit; color: var(--black);
  padding: 0.6rem 0.85rem;
  border: 2px solid var(--black); border-radius: var(--radius);
}
.task-form input[type="text"]:focus-visible,
.task-form input[type="number"]:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.task-form input[type="file"] { font: inherit; font-size: 0.95rem; }
.task-form input[type="file"]::file-selector-button {
  font: inherit; font-weight: 700; margin-right: 0.6rem; padding: 0.4rem 0.8rem;
  background: var(--white); border: 2px solid var(--black); border-radius: var(--radius); cursor: pointer;
}
.field-optional { font-weight: 400; color: var(--grey); }

/* Task list: one task per row */
.task-list { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--black); }
.task-list > li { border-bottom: 1px solid var(--line); }
.task {
  display: grid; gap: 1rem 1.5rem;
  padding-block: 1.5rem;
}
@media (min-width: 640px) {
  .task:has(.task-photo) { grid-template-columns: 180px 1fr; }
}
.task-photo .ba-placeholder,
.task-photo img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: var(--radius);
}
.task-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline;
  gap: 0.25rem 1rem;
}
.task-place { margin: 0; font-size: clamp(1.3rem, 2.6vw, 1.6rem); }
.task-due { margin: 0; font-weight: 700; white-space: nowrap; }
.task-due.is-due-soon { color: var(--red); }

.task-meta {
  display: flex; flex-wrap: wrap; gap: 0.25rem 2rem;
  margin: 0.5rem 0 0;
}
.task-meta div { display: flex; gap: 0.4rem; }
.task-meta dt { color: var(--grey); }
.task-meta dd { margin: 0; font-weight: 700; }

.task-desc { margin-top: 0.75rem; }
.task-desc > summary {
  display: inline-block; list-style: none; cursor: pointer;
  font-weight: 600; text-decoration: underline; text-underline-offset: 3px;
  min-height: 32px; line-height: 32px;
}
.task-desc > summary::-webkit-details-marker { display: none; }
.task-desc > summary:hover { color: var(--red); }
.task-desc > summary::after { content: " +"; }
.task-desc[open] > summary::after { content: " \2212"; }
.task-desc p { margin: 0.5rem 0 0; color: var(--black); max-width: 65ch; }
@media (max-width: 639px) {
  .task-photo .ba-placeholder, .task-photo img { aspect-ratio: 16 / 9; }
}

/* Task points */
.task-title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.75rem; }
.task-points {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  background: var(--black); color: var(--white);
  border-radius: 999px;
  font-weight: 800; font-size: 0.9rem; font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Task status + actions */
.task-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 0.75rem;
  margin-top: 1rem;
}
.task-actions form { margin: 0; }
.task-actions .btn { min-height: 40px; padding: 0.4rem 1rem; }
.task-status {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-weight: 700; font-size: 0.95rem;
}
.task-status::before {
  content: ""; width: 0.6rem; height: 0.6rem; border-radius: 50%;
  border: 2px solid var(--black);
}
.task-status.is-pending::before { border-color: var(--red); background: var(--red); }
.task-status.is-done::before { background: var(--black); }

/* Finished tasks recede */
.task.is-done .task-place { text-decoration: line-through; text-decoration-thickness: 2px; }
.task.is-done .task-points { background: var(--white); color: var(--black); box-shadow: inset 0 0 0 2px var(--black); }
.task.is-done .task-due,
.task.is-done .task-meta dd { color: var(--grey); }

/* ---------- Admin page ---------- */
.admin-page { max-width: 1040px; padding-block: clamp(2.5rem, 7vw, 4.5rem); }
.admin-page .lead { margin-bottom: 1.75rem; }
body[data-role="admin"] .admin-denied { display: none; }
.admin-denied {
  padding: 1.25rem 1.5rem; border: 1px solid var(--line); border-left: 4px solid var(--red);
  border-radius: var(--radius); background: var(--surface); max-width: 60ch;
}

/* Jump links to each section */
.admin-tabs {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  margin-bottom: clamp(2rem, 5vw, 3rem);
}
.admin-tabs a {
  display: inline-flex; align-items: center; gap: 0.5rem;
  min-height: 40px; padding: 0.35rem 0.5rem 0.35rem 0.9rem;
  border: 1px solid var(--line); border-radius: 999px;
  text-decoration: none; font-weight: 600; font-size: 0.95rem;
  transition: border-color 160ms ease, color 160ms ease;
}
.admin-tabs a:hover { border-color: var(--black); color: var(--black); }
.admin-count {
  min-width: 1.75rem; padding: 0.05rem 0.5rem; border-radius: 999px;
  background: var(--surface); text-align: center; font-size: 0.85rem; font-variant-numeric: tabular-nums;
}
.admin-tabs a:first-child .admin-count { background: var(--red); color: var(--white); } /* things waiting on you */

.admin-section { margin-bottom: clamp(3rem, 7vw, 4.5rem); scroll-margin-top: 90px; }
.admin-empty { color: var(--grey); }

/* Cleanups to approve */
.approval-list { display: grid; gap: 1.75rem; }
@media (min-width: 760px) { .approval-list { grid-template-columns: 1fr 1fr; } }
.approval {
  display: grid; gap: 1rem;
  padding: 0.75rem; border: 1px solid var(--line); border-radius: 16px;
}
.approval .ba-pair img, .approval .ba-placeholder { aspect-ratio: 4 / 3; }
.approval-body { padding: 0 0.25rem 0.25rem; }
.approval .sub-meta { margin-top: 0; }
.approval-actions {
  display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 0.75rem;
  margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line);
}
.approval-approve { display: flex; align-items: end; gap: 0.6rem; }
.approval-points { display: grid; gap: 0.2rem; font-size: 0.85rem; font-weight: 700; }
.approval-actions .btn { min-height: 44px; padding: 0.4rem 1.1rem; }

/* Inputs on the admin page (approve points, people table) */
.admin-page input[type="number"],
.admin-page .people-table input[type="text"] {
  font: inherit; color: var(--black); background: var(--white);
  min-height: 44px; padding: 0.4rem 0.6rem;
  border: 1px solid #c9c9c9; border-radius: var(--radius);
  transition: border-color 160ms ease;
}
.admin-page input[type="number"] { width: 5.5rem; font-variant-numeric: tabular-nums; }
.admin-page .people-table input[type="text"] { width: 100%; min-width: 8rem; }
.admin-page input:hover { border-color: var(--black); }
.admin-page input:focus-visible { outline: 3px solid var(--red); outline-offset: 1px; border-color: var(--black); }
.admin-page .task-form input[type="number"] { width: 100%; }

/* Tables (tasks, people) */
.admin-page .assign-task { margin-bottom: 1.5rem; }
.admin-table-wrap { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.98rem; }
.admin-table th, .admin-table td { padding: 0.7rem 1rem; text-align: left; vertical-align: middle; }
.admin-table thead th {
  background: var(--surface); font-size: 0.85rem; font-weight: 700; color: var(--grey);
  border-bottom: 1px solid var(--line);
}
.admin-table tbody tr + tr { border-top: 1px solid var(--line); }
.admin-table tbody th { font-weight: 750; }
.admin-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.admin-table .row-action { width: 1%; white-space: nowrap; text-align: right; }
.admin-table .row-action .btn { min-height: 40px; padding: 0.35rem 1rem; }
.admin-table time.is-due-soon { color: var(--red); font-weight: 700; }
.admin-table tr.is-done th { text-decoration: line-through; color: var(--grey); }
.admin-table tr.is-done td { color: var(--grey); }
.person-email { color: var(--grey); font-size: 0.92rem; }

/* Destructive button: quiet until you point at it */
.btn-danger { background: var(--white); color: var(--red); border-color: #f1b5b0; }
.btn-danger:hover { background: var(--red); border-color: var(--red); color: var(--white); }

/* Phones: each table row becomes a small card with labels */
@media (max-width: 699px) {
  .admin-table-wrap { border: 0; border-radius: 0; overflow: visible; }
  .admin-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .admin-table, .admin-table tbody, .admin-table tr, .admin-table th, .admin-table td { display: block; }
  .admin-table tbody tr {
    display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem 1rem;
    padding: 1rem; border: 1px solid var(--line); border-radius: 12px;
  }
  .admin-table tbody tr + tr { border-top: 1px solid var(--line); margin-top: 0.75rem; }
  .admin-table th, .admin-table td { padding: 0; }
  .admin-table [data-label]::before {
    content: attr(data-label); display: block;
    font-size: 0.8rem; font-weight: 600; color: var(--grey); text-decoration: none;
  }
  .admin-table .num { text-align: left; }
  .admin-table tbody th[data-label], .admin-table .row-action { grid-column: 1 / -1; }
  .admin-table .row-action { width: auto; text-align: left; }
  .admin-table .row-action .btn { width: 100%; }
  .people-table td[data-label="Name"], .people-table .person-email { grid-column: 1 / -1; }
}

/* ---------- Home: how points work (one line, no divider) ---------- */
.points-rate {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1rem;
  margin: 0; max-width: none;
  font-stretch: 125%; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em;
  font-size: clamp(1.35rem, 3vw, 2rem);
}
.points-rate-result { display: inline-flex; align-items: baseline; gap: 1rem; white-space: nowrap; } /* "= 10 points" never splits */
.points-rate-eq { color: var(--grey); font-weight: 600; }

/* ---------- Empty states (shown until the page script has real data) ---------- */
.empty-state {
  grid-column: 1 / -1; list-style: none;
  margin: 0; max-width: none; padding: 2rem 1.5rem;
  border: 1px dashed #d4d4d8; border-radius: 12px;
  color: var(--grey); text-align: center;
}
.stairs .stairs-status { align-self: center; text-align: center; padding-inline: 1rem; }
.admin-table .table-empty td { color: var(--grey); text-align: center; padding-block: 1.5rem; }
@media (max-width: 699px) {
  .admin-table tbody tr.table-empty { display: block; }
}

/* ---------- Posts: admin-only delete ---------- */
.post-admin {
  clear: both; display: flex; justify-content: flex-end;
  margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px dashed var(--line);
}
.post-admin .btn { min-height: 36px; padding: 0.25rem 0.9rem; font-size: 0.9rem; }
.post-admin .btn:disabled { opacity: 0.6; cursor: progress; }
