/* ==========================================================================
   NorthForge — site styles
   Single stylesheet for every page. Dark theme only.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */

:root {
  --bg:            #0c0e11;
  --bg-raised:     #13161a;
  --bg-sunken:     #090b0d;

  --border:        #232830;
  --border-strong: #333a44;

  --text:          #e7e9ec;
  --text-muted:    #98a1ad;
  --text-faint:    #6b7480;

  --link:          #8fb3e0;
  --link-hover:    #b6cff0;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", monospace;

  --measure: 46rem;   /* readable line length for body copy */
  --gutter:  1.5rem;

  color-scheme: dark;
}

/* --------------------------------------------------------------------------
   2. Reset and base
   -------------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

h1, h2, h3, h4 {
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

p {
  margin: 0;
}

a {
  color: var(--link);
  text-decoration: none;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

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

img {
  max-width: 100%;
  height: auto;
  display: block;
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1em 0.35em;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* --------------------------------------------------------------------------
   3. Layout helpers
   -------------------------------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  padding: 0.6rem 1rem;
  z-index: 10;
}

.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

/* --------------------------------------------------------------------------
   4. Header
   -------------------------------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 4rem;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.brand:hover {
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
}

.site-nav {
  display: flex;
  gap: 1.5rem;
  font-size: 0.9375rem;
}

.site-nav a {
  color: var(--text-muted);
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   5. Main content
   -------------------------------------------------------------------------- */

main {
  flex: 1 0 auto;
  padding-block: 4rem 5rem;
}

.page-title {
  font-size: 1.75rem;
}

.lede {
  color: var(--text-muted);
  margin-top: 0.75rem;
  max-width: 34rem;
}

/* Section rhythm ---------------------------------------------------------- */

.section {
  margin-top: 4rem;
}

.section-title {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-faint);
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.75rem;
}

.stack > * + * {
  margin-top: 1rem;
}

/* --------------------------------------------------------------------------
   6. Home — masthead and products
   -------------------------------------------------------------------------- */

.masthead {
  padding-block: 1rem 0;
}

.masthead h1 {
  font-size: 2rem;
  letter-spacing: -0.02em;
}

.masthead .lede {
  font-size: 1.125rem;
  color: var(--text);
}

.card {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-raised);
  padding: 1.75rem;
}

.card h3 {
  font-size: 1.125rem;
}

.card p {
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.card .btn {
  margin-top: 1.5rem;
}

/* --------------------------------------------------------------------------
   7. Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-block;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 0.5rem 1.125rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
  background: transparent;
}

.btn:hover {
  background: var(--bg-raised);
  border-color: var(--text-faint);
  color: var(--text);
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   8. Link lists (legal index, support routes)
   -------------------------------------------------------------------------- */

.link-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}

.link-list li {
  border-bottom: 1px solid var(--border);
}

.link-list a {
  display: block;
  padding: 1rem 0;
  color: var(--text);
}

.link-list a:hover {
  color: var(--link-hover);
  text-decoration: none;
}

.link-list .link-desc {
  display: block;
  color: var(--text-muted);
  font-size: 0.9375rem;
  margin-top: 0.125rem;
}

/* Definition-style rows (support details) --------------------------------- */

.details {
  margin: 0;
  border-top: 1px solid var(--border);
}

.details > div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.details dt {
  min-width: 9rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.details dd {
  margin: 0;
  flex: 1 1 14rem;
}

/* Values not yet filled in, such as an unpublished store link */

.pending {
  color: var(--text-faint);
}

/* --------------------------------------------------------------------------
   9. Documents — generated from the markdown sources
   -------------------------------------------------------------------------- */

.doc-kicker {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.doc-meta {
  color: var(--text-faint);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

.toc {
  margin-top: 2.5rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-raised);
}

.toc h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-faint);
  margin-bottom: 0.75rem;
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.9375rem;
  columns: 2;
  column-gap: 2rem;
}

.toc li {
  margin-bottom: 0.375rem;
  break-inside: avoid;
}

/* Prose ------------------------------------------------------------------- */

.prose {
  margin-top: 3rem;
}

.prose > * + * {
  margin-top: 1.125rem;
}

.prose h2 {
  font-size: 1.3125rem;
  margin-top: 3rem;
  padding-top: 0.25rem;
}

.prose h3 {
  font-size: 1.0625rem;
  color: var(--text);
  margin-top: 2.25rem;
}

.prose h2 + *,
.prose h3 + * {
  margin-top: 0.875rem;
}

.prose ul,
.prose ol {
  margin-top: 1rem;
  padding-left: 1.25rem;
}

.prose li + li {
  margin-top: 0.5rem;
}

.prose li::marker {
  color: var(--text-faint);
}

.prose strong {
  color: #fff;
  font-weight: 600;
}

.prose blockquote {
  margin: 1.5rem 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 2px solid var(--border-strong);
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.prose blockquote > * + * {
  margin-top: 0.875rem;
}

/* Tables: scroll horizontally rather than forcing the page to */

.table-scroll {
  overflow-x: auto;
  margin-top: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.prose table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9375rem;
}

.prose th,
.prose td {
  text-align: left;
  vertical-align: top;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.prose thead th {
  background: var(--bg-raised);
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}

.prose tbody tr:last-child td {
  border-bottom: 0;
}

.prose td {
  color: var(--text-muted);
}

/* Cross-links at the foot of a document ----------------------------------- */

.doc-related {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.doc-related h2 {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-faint);
  margin-bottom: 1rem;
}

.doc-related-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.75rem;
  font-size: 0.9375rem;
}

/* --------------------------------------------------------------------------
   10. Footer
   -------------------------------------------------------------------------- */

.site-footer {
  flex: none;
  border-top: 1px solid var(--border);
  padding-block: 2rem;
  font-size: 0.875rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
}

.footer-nav a {
  color: var(--text-muted);
}

.footer-nav a:hover {
  color: var(--text);
}

.footer-note {
  color: var(--text-faint);
}

/* --------------------------------------------------------------------------
   11. Narrow screens
   -------------------------------------------------------------------------- */

@media (max-width: 34rem) {
  :root {
    --gutter: 1.25rem;
  }

  main {
    padding-block: 2.5rem 3.5rem;
  }

  .masthead h1 {
    font-size: 1.75rem;
  }

  .section {
    margin-top: 3rem;
  }

  .card {
    padding: 1.25rem;
  }

  .toc ol {
    columns: 1;
  }
}
