/* Shared by every page: colours, page layout, the top bar, buttons, inputs
   and the posts list. These are working pages for whoever runs the site, so
   they stay plain and quiet: neutral greys like Caleb's site, system fonts.

   media/media.css adds the upload area, file list and dialogs.
   editor/editor.css adds the post editor. */

:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #6b6b6b;
  --rule: #e2e2e2;
  --soft: #f5f5f5;
  --ok: #2f6b3a;
  --ok-soft: #e3f0e5;
  --warn: #6b4e12;
  --warn-soft: #fbf3e2;
  --error: #9b2c1f;
  --focus: #1f5fbf;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

/* ---- page ---------------------------------------------------------------- */

.page {
  max-width: 48rem;
  margin: 0 auto;
  padding: 2.5rem 1rem 5rem;
}

.page-title { margin: 0 0 0.25rem; font-weight: 500; font-size: 2rem; }
.page-lede { margin: 0 0 1.5rem; color: var(--muted); }
.page-heading { margin: 2.5rem 0 0.75rem; font-weight: 500; font-size: 1.25rem; }
.empty-note { padding: 1rem 0; color: var(--muted); }

.notice {
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  background: var(--ok-soft);
  color: var(--ok);
}

/* ---- top bar ------------------------------------------------------------- */

.site-nav {
  display: flex;
  gap: 1.25rem;
  align-items: baseline;
  max-width: 48rem;
  margin: 0 auto;
  padding: 1rem 1rem 0;
  font-size: 0.9375rem;
}
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover { color: var(--text); }
.site-nav a[aria-current="page"] { color: var(--text); text-decoration: underline; text-underline-offset: 4px; }
.site-nav .site-nav__home { margin-right: auto; color: var(--text); font-weight: 600; }
.site-nav > * { white-space: nowrap; }
@media (max-width: 30rem) {
  .site-nav { gap: 0.8rem; font-size: 0.875rem; }
}

/* ---- buttons and inputs -------------------------------------------------- */

/* Also used on links that look like buttons (Download). */
.button {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  text-decoration: none;
  cursor: pointer;
}
/* :where() gives this rule the weight of one class, so a variant declared
   later (or in a page's own CSS) keeps its border colour on hover. */
.button:where(:hover:not(:disabled)) { border-color: var(--muted); }
.button:disabled { opacity: 0.4; cursor: default; }
.button--primary { background: var(--text); border-color: var(--text); color: var(--bg); }
.button--primary:hover:not(:disabled) { background: #333333; }
.button--danger { color: var(--error); }
.button--small { padding: 0.2rem 0.65rem; font-size: 0.8125rem; }

.input {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.input:focus { border-color: var(--muted); }

/* A post's state, "draft" or "published". The class name comes from the
   post's status. A Go test looks for editor-status--published, so keep the
   name. --changed marks a published post whose draft has edits that the
   public page doesn't show yet. */
.editor-status {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  vertical-align: middle;
}
.editor-status--draft { background: var(--soft); color: var(--muted); }
.editor-status--published { background: var(--ok-soft); color: var(--ok); }
.editor-status--changed { background: var(--warn-soft); color: var(--warn); }

/* ---- posts list (/posts) ------------------------------------------------- */

.posts-new { margin: 0 0 2rem; }
.posts-new__label { display: block; margin-bottom: 0.35rem; font-weight: 500; }
.posts-new__row { display: flex; gap: 0.5rem; }

.posts-list { list-style: none; margin: 0; padding: 0; }
.posts-list__item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--rule);
}
.posts-list__title { color: var(--text); font-weight: 500; font-size: 1.0625rem; }
.posts-list__meta { flex-basis: 100%; color: var(--muted); font-size: 0.8125rem; }

.posts-filter { display: flex; gap: 0.5rem; align-items: center; margin: 0 0 0.75rem; color: var(--muted); font-size: 0.875rem; }
.posts-filter__select { width: auto; padding: 0.25rem 0.5rem; font-size: 0.875rem; }

/* ---- signing in and people ---------------------------------------------- */

.page--narrow { max-width: 24rem; }

.site-nav form { margin: 0; }
.site-nav__signout {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}
.site-nav__signout:hover { color: var(--text); }

.auth-form { display: flex; flex-direction: column; gap: 0.35rem; }
.auth-form label { margin-top: 0.75rem; font-weight: 500; }
.auth-form .button { align-self: flex-start; margin-top: 1.25rem; }
.auth-hint { color: var(--muted); font-weight: 400; font-size: 0.875rem; }
.auth-help { margin-top: 2rem; color: var(--muted); font-size: 0.875rem; }

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

.link-made {
  margin: 0 0 2rem;
  padding: 1rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
}
.link-made__title { margin: 0 0 0.25rem; font-weight: 500; font-size: 1.0625rem; }
.link-made__url { font-family: ui-monospace, monospace; font-size: 0.8125rem; }

.people-list { list-style: none; margin: 0 0 1.5rem; padding: 0; }

/* Phone: two lines per person. The name, when they joined and their links,
   then the buttons. Wider screens: one line, with "joined" in its own
   column (people-list__meta) instead of beside the name. */
.people-list__item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "who     links"
    "actions actions";
  gap: 0.35rem 1rem;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--rule);
}
.people-list__who { grid-area: who; min-width: 0; overflow-wrap: anywhere; }
.people-list__name { font-weight: 500; }
.people-list__tag {
  margin-left: 0.35rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 0.75rem;
}
.people-list__since { color: var(--muted); font-size: 0.8125rem; white-space: nowrap; }
.people-list__meta { display: none; grid-area: meta; color: var(--muted); font-size: 0.8125rem; white-space: nowrap; }
.people-list__links { grid-area: links; justify-self: end; font-size: 0.875rem; white-space: nowrap; }
.people-list__links a { color: var(--text); text-underline-offset: 3px; }
.people-list__actions { grid-area: actions; display: flex; gap: 0.4rem; }
.people-list__actions form { margin: 0; }

/* The rows share the list's columns (subgrid), so dates, links and
   buttons line up from one person to the next. */
@media (min-width: 44rem) {
  .people-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    column-gap: 1.25rem;
  }
  .people-list__item {
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
    grid-template-areas: "who meta links actions";
  }
  .people-list__links { justify-self: start; }
  .people-list__since { display: none; }
  .people-list__meta { display: block; }
}
