/*
 * The shell (header, footer) and /admin. Loaded LAST, after Bootstrap,
 * styles.css and partnerings.css (see src/app/layout.tsx).
 *
 * Engage's tokens, as in partnerings.css: cream surfaces (#FAF7F1) on a warm
 * ground (#F0ECE4), near-black text, grey secondary text, RED as the one
 * interactive accent. No Tailwind here on purpose: the imported pages are
 * Bootstrap 4, and Bootstrap's unlayered CSS would beat Tailwind's layered
 * utilities wherever their class names collide (p-4, rounded, border...).
 */
:root {
  --brand-red: #cc0000;
  --brand-red-hover: #a80000;
  --brand-black: #1a1a1a;
  --brand-grey: #6b6b6b;
  --brand-ground: #f0ece4;
  --brand-surface: #faf7f1;
  --brand-line: rgba(0, 0, 0, 0.06);
  --header-h: 4.5rem;
  color-scheme: light;
}

html { font-size: 107%; }
body.site-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--brand-ground);
  color: var(--brand-black);
  font-family: Arial, Helvetica, sans-serif;
}
.site-main { flex: 1 0 auto; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1030;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1rem;
  background: var(--brand-surface);
  border-bottom: 1px solid var(--brand-line);
}
.site-header__brand { display: flex; align-items: center; flex-shrink: 0; }
.site-header__brand img { display: block; height: auto; max-width: 150px; }
.site-header__nav { display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; justify-content: flex-end; }
.site-header__nav a {
  font-size: 0.875rem;
  color: var(--brand-grey);
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  text-decoration: none;
  transition: color 0.15s, background-color 0.15s;
}
.site-header__nav a:hover, .site-header__nav a:focus { color: var(--brand-red); background: var(--brand-ground); }
/* The home page: the logo centred and 50% larger, a search box below it,
   sticky like every header (2026-10-07). */
.site-header--home {
  height: auto;
  flex-direction: column;
  justify-content: center;
  gap: 0.6rem;
  padding: 1rem 1rem 0.85rem;
}
.site-header--home .site-header__brand img { max-width: 225px; }
.site-search { position: relative; width: min(28rem, 100%); }
.site-search__input {
  width: 100%;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 9999px;
  background: var(--brand-surface);
  color: var(--brand-black);
}
.site-search__input { text-align: center; }
.site-search__input:focus { outline: none; border-color: var(--brand-red); box-shadow: 0 0 0 1px var(--brand-red); }
.site-search__results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.35rem);
  z-index: 1040;
  list-style: none;
  margin: 0;
  padding: 0.35rem;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--brand-surface);
  border: 1px solid var(--brand-line);
  border-radius: 0.5rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  text-align: left;
}
.site-search__results a { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.5rem 0.65rem; border-radius: 0.375rem; color: var(--brand-black); text-decoration: none; }
.site-search__results a.is-active, .site-search__results a:hover { background: var(--brand-ground); }
.site-search__results a.is-active .site-search__title { color: var(--brand-red); }
.site-search__title { font-size: 0.9rem; font-weight: 600; }
.site-search__snippet { font-size: 0.78rem; color: var(--brand-grey); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.site-search__empty { font-size: 0.85rem; color: var(--brand-grey); padding: 0.5rem 0.65rem; }

@media (max-width: 420px) {
  .site-header--home .site-header__brand img { max-width: 180px; }
  .site-header__brand img { max-width: 110px; }
  .site-header__nav a { padding: 0.35rem 0.45rem; }
}

/* The imported pages' own sticky navbars (HEJ, PAK, PhoVoCo, the founder's
   sidebar) stick BELOW the site header instead of under it. */
.site-main .sticky-top { top: var(--header-h); z-index: 1020; }
.site-main img { max-width: 100%; }

/* ---------- Footer ---------- */
footer.site-footer {
  flex-shrink: 0;
  margin-top: 2rem;
  padding: 2rem 1rem;
  text-align: center;
  background: var(--brand-surface) !important;
  border-top: 1px solid var(--brand-line) !important;
  border-radius: 0 !important;
}
.site-footer p { margin: 0.25rem auto 0; font-size: 0.875rem; color: var(--brand-grey); max-width: 28rem; }
.site-footer__mark { display: block; width: fit-content; margin: 0 auto 0.75rem; }
.site-footer__mark img { display: block; border-radius: 9999px; }
.site-footer__links { margin-top: 0.75rem !important; }
.site-footer__links a { color: var(--brand-black); text-decoration: none; }
.site-footer__links a:hover { color: var(--brand-red); }
.site-footer__links span { margin: 0 0.5rem; color: rgba(107, 107, 107, 0.5); }

/* ---------- Admin ---------- */
.admin { max-width: 72rem; margin: 0 auto; padding: 1.5rem 1rem 2rem; }
.admin-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.75rem 1rem;
  background: var(--brand-surface);
  border-bottom: 1px solid var(--brand-line);
}
.admin-bar__title { font-weight: 600; font-size: 0.95rem; }
.admin-bar__nav { display: flex; gap: 0.25rem; flex-wrap: wrap; align-items: center; }
.admin-bar__nav a, .admin-bar__nav button {
  font-size: 0.85rem;
  color: var(--brand-grey);
  padding: 0.3rem 0.7rem;
  border-radius: 9999px;
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: none;
}
.admin-bar__nav a:hover, .admin-bar__nav button:hover { color: var(--brand-red); background: var(--brand-ground); }
.admin-bar__nav a[aria-current="page"] { color: var(--brand-red); background: rgba(204, 0, 0, 0.08); }
.admin-bar__who { font-size: 0.8rem; color: var(--brand-grey); }

.admin h1 { font-size: 1.6rem; margin: 0 0 0.25rem; }
.admin .lede { color: var(--brand-grey); margin: 0 0 1.5rem; max-width: 46rem; }
.admin h2 { font-size: 1.05rem; margin: 0 0 0.75rem; }
.admin-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); }
.admin-card {
  background: var(--brand-surface);
  border: 1px solid var(--brand-line);
  border-radius: 0.5rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  padding: 1.25rem;
}
.admin-card + .admin-card { margin-top: 0; }
.admin-card__head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; margin-bottom: 0.75rem; }
.admin-card__head h2 { margin: 0; }
.admin-card__sub { font-size: 0.8rem; color: var(--brand-grey); }
.admin-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; margin: 0 0 1rem; }
.admin-stat { background: var(--brand-ground); border-radius: 0.375rem; padding: 0.6rem 0.75rem; }
.admin-stat dt { font-size: 0.75rem; color: var(--brand-grey); font-weight: 400; }
.admin-stat dd { margin: 0.15rem 0 0; font-size: 1.25rem; font-weight: 600; }
.admin-stat--alert dd { color: var(--brand-red); }
.admin-links { list-style: none; padding: 0; margin: 0; font-size: 0.875rem; }
.admin-links li + li { margin-top: 0.3rem; }
.admin-links a { color: var(--brand-black); }
.admin-links a:hover { color: var(--brand-red); }
.admin-unavailable { font-size: 0.85rem; color: var(--brand-grey); background: var(--brand-ground); border-radius: 0.375rem; padding: 0.6rem 0.75rem; margin: 0 0 1rem; }

.pill { display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 0.15rem 0.55rem; border-radius: 9999px; vertical-align: middle; }
.pill--on { background: rgba(22, 163, 74, 0.1); color: #15803d; }
.pill--off { background: rgba(0, 0, 0, 0.06); color: var(--brand-grey); }
.pill--warn { background: rgba(204, 0, 0, 0.08); color: var(--brand-red); }

.admin-switch { display: grid; gap: 0.75rem; }
.admin-switch__row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.admin-switch__gates { list-style: none; padding: 0; margin: 0; font-size: 0.85rem; display: grid; gap: 0.35rem; }
.admin-switch__gates code { font-size: 0.8rem; }
.admin-note { font-size: 0.85rem; color: var(--brand-grey); margin: 0; }
.admin-warn { font-size: 0.85rem; color: var(--brand-red); margin: 0; }
.admin-label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.3rem; }
.admin-input, .admin-textarea {
  width: 100%;
  font: inherit;
  font-size: 0.9rem;
  color: var(--brand-black);
  background: var(--brand-surface);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 0.375rem;
  padding: 0.5rem 0.65rem;
}
.admin-input:focus, .admin-textarea:focus { outline: none; border-color: var(--brand-red); box-shadow: 0 0 0 1px var(--brand-red); }
.admin-textarea { min-height: 4.5rem; resize: vertical; }
.admin-btn {
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.375rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--brand-red);
  background: var(--brand-red);
  color: #fff;
  cursor: pointer;
}
.admin-btn:hover { background: var(--brand-red-hover); border-color: var(--brand-red-hover); }
.admin-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.admin-btn--quiet { background: var(--brand-surface); color: var(--brand-black); border-color: rgba(0, 0, 0, 0.15); }
.admin-btn--quiet:hover { background: var(--brand-surface); color: var(--brand-red); border-color: var(--brand-red); }
.admin-confirm { border: 1px solid rgba(204, 0, 0, 0.3); border-radius: 0.375rem; padding: 0.75rem; background: rgba(204, 0, 0, 0.04); display: grid; gap: 0.6rem; }
.admin-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.login-wrap { display: flex; justify-content: center; padding: 3rem 1rem; }
.login-box { width: 100%; max-width: 24rem; }
.login-box .admin-card { padding: 2rem; }
.login-box h1 { font-size: 1.3rem; text-align: center; margin: 0 0 0.25rem; }
.login-box .lede { text-align: center; font-size: 0.9rem; color: var(--brand-grey); margin: 0 0 1.25rem; }
.login-field + .login-field { margin-top: 1rem; }
.login-box .admin-btn { width: 100%; margin-top: 1.25rem; }
.login-box .admin-warn { margin-top: 0.75rem; }

/* ---------- /admin/pages - the page editor (2026-10-07) ---------- */
.admin-pages__filters { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.5rem; }
.admin-pages__filters .admin-input { flex: 1 1 16rem; }
.admin-pages__check { display: flex; gap: 0.35rem; align-items: center; }
.admin-pages { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.admin-pages li { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.5rem 0; border-top: 1px solid var(--brand-line); flex-wrap: wrap; }
.admin-pages a { display: flex; flex-direction: column; color: var(--brand-black); min-width: 0; }
.admin-pages a:hover .admin-pages__title { color: var(--brand-red); }
.admin-pages__title { font-size: 0.9rem; font-weight: 600; }
.admin-pages__url { font-size: 0.75rem; color: var(--brand-grey); word-break: break-all; }
.admin-pages__state { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.admin-pill { font-size: 0.7rem; font-weight: 600; padding: 0.1rem 0.5rem; border-radius: 9999px; background: rgba(22, 163, 74, 0.1); color: #15803d; white-space: nowrap; }
.admin-pill--draft { background: rgba(204, 0, 0, 0.08); color: var(--brand-red); }
.admin-pill--quiet { background: var(--brand-ground); color: var(--brand-grey); }
.admin-ok { color: #15803d; }

.admin-editor__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.admin-editor__head h1 { margin-bottom: 0.25rem; }
.admin-editor { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr) 18rem; align-items: start; }
@media (max-width: 900px) { .admin-editor { grid-template-columns: minmax(0, 1fr); } }
.admin-editor__side { display: grid; gap: 1rem; position: sticky; top: calc(var(--header-h) + 1rem); }
.admin-editor__tools { display: flex; gap: 0.35rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.5rem; }
.admin-editor__tools button { font-size: 0.8rem; padding: 0.25rem 0.6rem; border: 1px solid rgba(0, 0, 0, 0.15); border-radius: 0.375rem; background: var(--brand-surface); color: var(--brand-black); }
.admin-editor__tools button:hover { color: var(--brand-red); border-color: var(--brand-red); }
.admin-editor__frame { width: 100%; height: 75vh; border: 1px solid var(--brand-line); border-radius: 0.5rem; background: var(--brand-ground); }
.admin-editor__code { width: 100%; height: 75vh; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; line-height: 1.5; white-space: pre; }
.admin-history { list-style: none; padding: 0; margin: 0; max-height: 50vh; overflow-y: auto; }
.admin-history li + li { border-top: 1px solid var(--brand-line); }
.admin-history button { display: flex; flex-direction: column; gap: 0.15rem; width: 100%; text-align: left; padding: 0.45rem 0.35rem; background: none; border: 0; border-radius: 0.375rem; font-size: 0.85rem; color: var(--brand-black); }
.admin-history button:hover { background: var(--brand-ground); }
.admin-history button[aria-current="true"] { background: rgba(204, 0, 0, 0.06); }
.admin-history__meta { font-size: 0.75rem; color: var(--brand-grey); }
.admin-history__note { font-size: 0.75rem; color: var(--brand-black); font-style: italic; }

/* Search in the middle of every page's header (2026-10-07). */
.site-header:not(.site-header--home) .site-search { flex: 1 1 auto; max-width: 26rem; }
.site-header:not(.site-header--home) .site-search__input { padding: 0.4rem 0.9rem; font-size: 0.85rem; }
@media (max-width: 700px) {
  .site-header:not(.site-header--home) { height: auto; flex-wrap: wrap; padding: 0.6rem 1rem; }
  .site-header:not(.site-header--home) .site-search { order: 3; flex-basis: 100%; max-width: none; }
}

/* The About section: a sidebar of /about/ and the pages under it (2026-10-07). */
.about-layout { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 1.5rem; align-items: start; max-width: 1200px; margin: 0 auto; padding: 1.5rem 1rem 0; }
.about-side { position: sticky; top: calc(var(--header-h) + 1rem); }
.about-side nav { display: flex; flex-direction: column; gap: 0.15rem; background: var(--brand-surface); border: 1px solid var(--brand-line); border-radius: 0.5rem; padding: 0.5rem; }
.about-side a { font-size: 0.9rem; color: var(--brand-black); padding: 0.4rem 0.65rem; border-radius: 0.375rem; text-decoration: none; }
.about-side a:hover { color: var(--brand-red); background: var(--brand-ground); }
.about-side a[aria-current="page"] { color: var(--brand-red); background: rgba(204, 0, 0, 0.08); }
@media (max-width: 800px) {
  .about-layout { grid-template-columns: minmax(0, 1fr); }
  .about-side { position: static; }
}
.admin-tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--brand-line); margin-bottom: 0.75rem; }
.admin-tabs button { background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 0.4rem 0.75rem; font-size: 0.9rem; color: var(--brand-grey); }
.admin-tabs button span { font-size: 0.75rem; color: var(--brand-grey); }
.admin-tabs button[aria-selected="true"] { color: var(--brand-red); border-bottom-color: var(--brand-red); }
a.admin-btn { display: inline-block; text-decoration: none; color: #fff; }
a.admin-btn:hover { color: #fff; }
.admin-form { display: grid; gap: 0.75rem; max-width: 36rem; }
.admin-form__row { display: grid; gap: 0.75rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 600px) { .admin-form__row { grid-template-columns: 1fr; } }
.admin-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr)); gap: 0.4rem; max-height: 14rem; overflow-y: auto; margin-top: 0.5rem; }
.admin-images button { padding: 0; border: 1px solid var(--brand-line); border-radius: 0.375rem; background: var(--brand-ground); aspect-ratio: 1; overflow: hidden; }
.admin-images button:hover { border-color: var(--brand-red); }
.admin-images img { width: 100%; height: 100%; object-fit: cover; display: block; }
.admin-status { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.admin-linkbtn { background: none; border: 0; padding: 0; font-size: 0.85rem; color: var(--brand-grey); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.admin-linkbtn:hover { color: var(--brand-red); }
.admin-linkbtn--danger { color: var(--brand-red); }
