/* App shell. One markup tree, two shapes:
     <= 768px  bottom tab bar, full-bleed content   (mobile web)
     >= 769px  left rail, centred content            (desktop web)
   No JS decides this — the same DOM reflows. */

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Rail (desktop) ──────────────────────────────────────────────────────── */

.rail { display: none; }

.rail__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 24px;
}

.rail__nav { display: flex; flex-direction: column; gap: 2px; }

.rail__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-xs);
  color: var(--text-mute);
  font-size: 15px;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
}

.rail__link:hover { background: var(--bg-card); color: var(--text-hi); }

.rail__link[aria-current='page'] {
  background: var(--accent-tint);
  color: var(--accent);
  font-weight: 600;
}

.rail__foot { margin-top: auto; padding: 12px; }

/* ── Top bar (mobile) ────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(12px + var(--safe-t)) 18px 12px;
  background: color-mix(in srgb, var(--bg-app) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-hairline);
}

/* ── Content ─────────────────────────────────────────────────────────────── */

.main {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 24px 18px calc(var(--tabbar-h) + var(--safe-b) + 32px);
}

.main--wide { max-width: var(--wide-max); }

.section { margin-bottom: 40px; }
.section:last-child { margin-bottom: 0; }

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.stack { display: flex; flex-direction: column; gap: 12px; }
.stack--tight { gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; }
.row--wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

.grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* ── Tab bar (mobile) ────────────────────────────────────────────────────── */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  padding: 8px 6px calc(8px + var(--safe-b));
  background: color-mix(in srgb, var(--bg-app) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line-hairline);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 0;
  color: var(--text-dim);
  transition: color 0.12s;
}

.tab[aria-current='page'] { color: var(--accent); }
.tab__label { font-size: 10px; font-weight: 600; letter-spacing: 0.01em; }

/* ── Desktop swap ────────────────────────────────────────────────────────── */

@media (min-width: 769px) {
  .shell {
    flex-direction: row;
    max-width: calc(var(--rail-w) + var(--wide-max));
    margin: 0 auto;
  }

  .rail {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    width: var(--rail-w);
    flex: none;
    padding: 24px 12px;
    border-right: 1px solid var(--line-hairline);
  }

  .topbar { display: none; }
  .tabbar { display: none; }

  .main {
    padding: 40px 32px 64px;
    max-width: var(--content-max);
    margin: 0;
  }

  .main--wide { max-width: none; }
}

/* Reading surfaces — public record and article pages, no shell chrome. */
.page {
  max-width: 780px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

@media (min-width: 769px) {
  .page { padding: 56px 24px 96px; }
}

/* ── Marketing chrome ────────────────────────────────────────────────────── */
/* The public website's top nav and footer. The app rail/tab bar (above) stay
   the signed-in app's chrome at /app; these are for pages that exist to be
   arrived at from a link. */

.site { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 26px;
  max-width: var(--wide-max);
  width: 100%;
  margin: 0 auto;
  padding: 18px 24px;
}

.site-nav__links { display: flex; align-items: center; gap: 24px; flex: 1; }

.site-nav__links a {
  color: var(--text-mute);
  font-size: 14.5px;
  font-weight: 500;
}
.site-nav__links a:hover { color: var(--text-hi); }
.site-nav__links a[aria-current='page'] { color: var(--text-hi); font-weight: 600; }

.site-nav__actions { display: flex; align-items: center; gap: 10px; }

.site-main {
  flex: 1;
  width: 100%;
  max-width: var(--wide-max);
  margin: 0 auto;
  padding: 32px 24px 88px;
}

.site-footer {
  border-top: 1px solid var(--line-hairline);
  background: var(--bg-canvas);
}

.site-footer__cols {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr));
  gap: 32px;
  max-width: var(--wide-max);
  margin: 0 auto;
  padding: 44px 24px 28px;
}

.site-footer__cols nav { display: flex; flex-direction: column; gap: 10px; }

.site-footer__head {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.site-footer__cols nav a { color: var(--text-mute); font-size: 14px; }
.site-footer__cols nav a:hover { color: var(--text-hi); }

.site-footer__legal {
  max-width: var(--wide-max);
  margin: 0 auto;
  padding: 0 24px 36px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-faint);
}

@media (max-width: 700px) {
  /* Brand + action on the first row; links wrap to their own line beneath.
     No hamburger — three links do not need a menu to hide in. */
  .site-nav { flex-wrap: wrap; gap: 14px 22px; padding: 16px 20px 12px; }
  .site-nav .brand { margin-right: auto; }
  .site-nav__links { order: 3; flex-basis: 100%; gap: 20px; }
  .site-main { padding: 20px 20px 72px; }
  .site-footer__cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-footer__brand { grid-column: 1 / -1; }
}

/* A text-weight sign-in beside the filled Get started — a returning user
   scans for the word, a new visitor is drawn to the button. */
.site-nav__signin {
  font-size: 14px; font-weight: 500;
  color: var(--text-mute); padding: 0 4px;
}
.site-nav__signin:hover { color: var(--text-hi); }
