/*
 * Site chrome for the oroup Source fork — everything that makes the blog
 * match the rest of oroup.com without touching Source's article styles.
 *
 * Loaded AFTER {{ghost_head}} (see default.hbs) so the :root rules here win
 * over Ghost-injected inline styles (custom-font vars, accent color).
 *
 * Three jobs:
 *   1. Pin Source's font vars to the main site's system stack (oroup.css
 *      body font) — this replaces Inter everywhere, headings and body.
 *   2. Style the common navbar (partials/site-nav.hbs), copied from
 *      oroup.css §Navbar with rem converted to px: Source sets
 *      html { font-size: 62.5% }, so oroup.css rem values (written against
 *      a 16px root) would render at 62.5% size if copied verbatim.
 *   3. Provide the site's --ui-* tokens (light + dark) for the navbar, and
 *      flip the Ghost accent to the site's dark-mode accent in dark mode
 *      (the light accent #2563eb is set in Ghost admin → Design → Brand).
 */

/* ===== 1. Fonts: the main site's stack, no webfonts ===== */
:root {
  --gh-font-heading: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif;
  --gh-font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif;
}

/* ===== 3. Tokens (oroup.css) + dark-mode accent ===== */
body {
  --ui-bg: #fff;
  --ui-fg: #1b1b1b;
  --ui-muted: #6b7280;
  --ui-border: #e5e7eb;
  --ui-surface: #fafafa;
  --ui-accent: #2563eb;
  --ui-accent-hover: #1d4ed8;
  --ui-on-accent: #fff;
}

@media (prefers-color-scheme: dark) {
  body {
    --ui-bg: #1a1a1a;
    --ui-fg: #e8e8e8;
    --ui-muted: #9aa1ab;
    --ui-border: #2a2e34;
    --ui-surface: #1b1e22;
    --ui-accent: #60a5fa;
    --ui-accent-hover: #93c5fd;
  }

  :root {
    --ghost-accent-color: #60a5fa;
  }
}

/* ===== 2. Common navbar (oroup.css §Navbar, rem → px @16px root) ===== */
.navbar {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding: 6px 0;
  font-size: 14px;
  background-color: var(--ui-surface);
}

.navbar > .container-fluid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding-right: 12px;
  padding-left: 12px;
  margin-right: auto;
  margin-left: auto;
}

.navbar-brand {
  padding-top: 5px;
  padding-bottom: 5px;
  margin-right: 16px;
  font-size: 20px;
  text-decoration: none;
  white-space: nowrap;
  color: var(--ui-fg);
}

.navbar-brand img {
  display: block;
  width: auto;
  height: 28px;
}

.navbar-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-left: 0;
  margin-top: 0;
  margin-bottom: 0;
  list-style: none;
}

/* Tab-style nav links echoing the apps' .ui-nav. */
.navbar-nav .nav-link {
  display: block;
  font-size: 13px;
  padding: 4px 10px;
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  color: var(--ui-fg);
  text-decoration: none;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link:focus {
  background: var(--ui-surface);
  color: var(--ui-accent);
}

.navbar-nav .nav-link.active {
  background: var(--ui-accent);
  border-color: var(--ui-accent);
  color: var(--ui-on-accent);
}

/* Toggler (hamburger) */
.navbar-toggler {
  padding: 4px 12px;
  font-size: 20px;
  font-family: inherit;
  line-height: 1;
  color: var(--ui-muted);
  background-color: transparent;
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  cursor: pointer;
}

.navbar-toggler:focus {
  box-shadow: 0 0 0 4px rgb(13 110 253 / 25%);
  outline: 0;
}

.navbar-toggler-icon {
  display: inline-block;
  width: 1.5em;
  height: 1.5em;
  vertical-align: middle;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2833, 37, 41, 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100%;
}

/* Collapse: hidden by default on small screens, shown on lg+ */
.navbar-collapse {
  flex-basis: 100%;
  flex-grow: 1;
  align-items: center;
}

.collapse:not(.show) { display: none; }

@media (width >= 992px) {
  .navbar-expand-lg { flex-wrap: nowrap; }
  .navbar-expand-lg > .container-fluid { flex-wrap: nowrap; }
  .navbar-expand-lg .navbar-nav { flex-direction: row; }
  .navbar-expand-lg .navbar-toggler { display: none; }

  .navbar-expand-lg .navbar-collapse,
  .navbar-expand-lg .collapse:not(.show) { display: flex !important; flex-basis: auto; }
}

.nav-item { list-style: none; }

/* Signed-in auth item ("email | Sign out" — swapped in by default.hbs's
   /auth/me script): the inner link, per oroup.css §Accessibility. */
.navbar .nav-link a { color: var(--ui-accent); text-decoration: underline; }
.navbar .nav-link a:hover { color: var(--ui-accent-hover); }

/* Spacing utilities used by the navbar markup (oroup.css, rem → px) */
.me-auto { margin-right: auto; }
.mb-2 { margin-bottom: 8px; }

@media (width >= 992px) {
  .mb-lg-0 { margin-bottom: 0; }
}

/* ===== Accessibility (oroup.css) ===== */
.visually-hidden,
.visually-hidden-focusable:not(:focus, :focus-within) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ===== Dark mode odds and ends (oroup.css) ===== */
@media (prefers-color-scheme: dark) {
  /* Navbar toggler (hamburger) */
  .navbar-toggler-icon { filter: invert(1); }
}
