/* pages.css -- topics index, topic + organization pages, organizations index,
   About, login and error pages. Uses tokens.css; values are copied from Atlas
   (spark-portfolio/atlas): Gallery.tsx grid/cards, ProjectView.tsx typography
   and client tile, app/login/LoginClient.tsx, app/not-found.tsx. Atlas greys
   that fail WCAG AA on white are swapped for --sp-faint / --sp-sec ("a11y:").
   Every rule is scoped to a wrapper_class these templates set (.sp-page,
   .sp-gallery) or to a class only these templates emit. */

/* ---------- CKAN boxes off (page.html article.module / module-content) ---------- */
.wrapper.sp-page,
.wrapper.sp-gallery { margin-left: 0; margin-right: 0; }
/* Bootstrap .row > * gutters; About's primary is a bare article.module. */
.sp-page > *,
.sp-gallery > * { padding-left: 0; padding-right: 0; }
.sp-page > .primary { width: 100%; max-width: 100%; flex: 0 0 100%; float: none; }
.sp-page .module,
.sp-gallery .module { background: none; border: 0; box-shadow: none; margin: 0; }
.sp-page .module > .module-content,
.sp-gallery .module > .module-content { padding: 0; }
.sp-page .media-grid {
  background: none; border: 0; min-height: 0; padding: 0; margin: 0;
}
/* Editors still get CKAN's tabs + Manage on topic/org pages; keep them quiet. */
.sp-gallery .module > .page-header { padding: 0 0 14px; margin: 0 0 20px; border-bottom: 1px solid #ececec; }
.sp-page .page_primary_action { margin: 0 0 18px; }

/* ---------- Card grid: Atlas Gallery.tsx grid view ---------- */
.sp-page .sp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
  list-style: none;
  padding: 10px 0 0;
  margin: 0;
}
.sp-page .sp-grid > li { display: flex; flex-direction: column; min-width: 0; margin: 0; padding: 0; float: none; width: auto; }
.sp-page .sp-grid > li > .sp-card { flex: 1; min-width: 0; }

/* Card shell, thumb stripes and topic hue (--c from [data-topic]) come from
   search.css, so a topic tile matches that topic's dataset cards. The body
   rules there are scoped to .dataset-list; these grids need them too. */
.sp-page .sp-grid .sp-card-body { display: flex; flex-direction: column; flex: 1; padding: 14px 15px 16px; }
.sp-page .sp-grid .sp-card-title {
  margin: 0 0 8px;
  font: 700 17.5px/1.2 var(--sp-display);
  letter-spacing: -.01em;
  color: var(--sp-ink);
  overflow-wrap: anywhere;
}

/* ---------- Topic tiles (/group) ---------- */
.sp-topic-grid .sp-thumb { aspect-ratio: 16 / 9; }
.sp-topic-grid > li:nth-child(4n+2) .sp-thumb { --a: 120deg; }
.sp-topic-grid > li:nth-child(4n+3) .sp-thumb { --a: 150deg; }
.sp-topic-grid > li:nth-child(4n) .sp-thumb { --a: 180deg; }
/* CKAN's "Remove" for group members in admin views. */
.sp-topic-grid .media-edit { margin-top: 8px; align-self: flex-start; }

/* ---------- Organization cards (/organization): ProjectView client tile ---------- */
.sp-org-card .sp-org-tile {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--sp-line);
  background: #fff;
  font: 700 16px var(--sp-display);
  color: var(--sp-accent-text);
  object-fit: contain;
  margin: 0 0 14px;
}

/* ---------- About: Atlas ProjectView typography (760px column) ---------- */
.sp-about-page .module-content { max-width: 760px; padding: 10px 0 0; }
.sp-about-page .sp-prose p,
.sp-about-page .sp-section p {
  font-size: 16px;
  line-height: 1.6;
  color: #3a3f44;
  margin: 0 0 26px;
}
.sp-about-page .sp-prose > :last-child { margin-bottom: 0; }
.sp-about-page .sp-prose h1,
.sp-about-page .sp-prose h2,
.sp-about-page .sp-prose h3 { font-family: var(--sp-display); color: var(--sp-ink); margin: 30px 0 12px; }
.sp-about-page .sp-section {
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid #ececec;
}
.sp-about-page .sp-section p { margin: 12px 0 0; }
.sp-about-page .sp-section-label {
  font: 400 10.5px var(--sp-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--sp-faint);            /* a11y: Atlas #8a8a8a */
  margin: 0;
}
.sp-about-page .sp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}
/* Atlas link chip: accent text, tinted border + background. */
.sp-about-page .sp-chip {
  display: inline-block;
  font: 400 12.5px var(--sp-mono);
  color: var(--sp-accent-text);
  border: 1px solid color-mix(in oklab, #0fa392 35%, #fff);
  background: color-mix(in oklab, #0fa392 6%, #fff);
  border-radius: 3px;
  padding: 5px 10px;
  text-decoration: none;
}
.sp-about-page .sp-chip:hover { border-color: var(--sp-accent); color: var(--sp-accent-deep); text-decoration: none; }

/* ---------- Login: Atlas app/login/LoginClient.tsx ---------- */
.sp-login-page { justify-content: center; }
.sp-login-page > .sp-login {
  width: 100%;
  max-width: 440px;
  flex: 0 1 440px;
  margin: 0 auto;
  padding: 72px 0 40px;
  float: none;
}
.sp-login-eyebrow {
  font: 400 10.5px var(--sp-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--sp-accent-text);
  margin: 0 0 14px;
}
.sp-login .sp-login-title {
  font: 700 clamp(28px, 5vw, 40px)/1.1 var(--sp-display);
  letter-spacing: -.02em;
  margin: 0 0 14px;
}
.sp-login-lede { font-size: 15.5px; line-height: 1.6; color: var(--sp-sec); margin: 0 0 28px; }
.sp-login .form-group { margin: 0 0 16px; }
.sp-login .form-label {
  display: block;
  font: 400 10.5px var(--sp-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--sp-faint);
  margin: 0 0 7px;
}
.sp-login .control-medium .controls,
.sp-login .form-control { width: 100%; max-width: none; }
.sp-login .form-control {
  padding: 12px 14px;
  border: 1px solid #dcdcdc;
  border-radius: 6px;
  font: 400 14.5px var(--sp-body);
  color: var(--sp-ink);
  background: #fff;
  box-shadow: none;
}
.sp-login .form-control:focus { border-color: var(--sp-accent); box-shadow: none; outline: none; }
.sp-login .form-control:focus-visible { outline: 2px solid var(--sp-accent); outline-offset: 2px; }
.sp-login label.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 400;
  color: var(--sp-sec);
  cursor: pointer;
}
.sp-login label.checkbox input { width: 17px; height: 17px; margin: 0; accent-color: var(--sp-accent-text); }
.sp-login .form-actions {
  margin: 22px 0 0;
  padding: 0;
  border: 0;
  background: none;
}
/* Atlas's full-width sign-in button: 14px 18px, 8px radius, 15px 600. */
.sp-login .form-actions .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  float: none;
  margin: 0;
  padding: 14px 18px;
  border-radius: 8px;
  border: 0;
  background: var(--sp-ink);
  color: #fff;
  font: 600 15px var(--sp-body);
  box-shadow: none;
}
.sp-login .form-actions .btn:hover { background: #2a2f33; color: #fff; }
.sp-login .error-explanation {
  border: 1px solid #dc262844;
  background: #dc262810;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.55;
  color: #991b1b;
  margin: 0 0 20px;
}
.sp-login .error-explanation ul { margin: 6px 0 0; padding-left: 18px; }
.sp-login-foot { font-size: 13px; line-height: 1.6; color: var(--sp-faint); margin: 22px 0 0; }
.sp-login-foot span { margin: 0 6px; }

/* ---------- Error / 404: Atlas app/not-found.tsx ---------- */
.sp-error-page > .sp-error {
  width: 100%;
  max-width: 100%;
  flex: 0 0 100%;
  float: none;
  min-height: 56vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 64px 0;
  text-align: center;
}
.sp-error > * { margin: 0; }
.sp-error-code {
  font: 400 13px var(--sp-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--sp-accent-text);
}
.sp-error .sp-error-title { font: 700 22px/1.2 var(--sp-display); color: var(--sp-ink); }
.sp-error-text { font-size: 15px; line-height: 1.55; color: #6a6f74; max-width: 420px; }
.sp-error-text p { margin: 0; }
.sp-error-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 20px;
  margin-top: 6px !important;
}
.sp-error-btn {
  padding: 11px 22px;
  border-radius: 7px;
  background: var(--sp-ink);
  color: #fff;
  text-decoration: none;
  font: 600 14.5px var(--sp-display);
}
.sp-error-btn:hover { background: #2a2f33; color: #fff; text-decoration: none; }
.sp-error-link { font: 400 12.5px var(--sp-mono); letter-spacing: .04em; color: #6a6f74; }

/* ---------- Responsive (Atlas breakpoints) ---------- */
@media (max-width: 600px) {
  .sp-page .sp-grid { grid-template-columns: 1fr; gap: 16px; }
  .sp-page .sp-card { border-radius: 14px; }
  .sp-topic-grid .sp-thumb { aspect-ratio: 5 / 2; }
  .sp-login-page > .sp-login { padding-top: 36px; }
}
