/* base.css — storyarc GUI foundation.
 *
 * Reset + document-level defaults wired to tokens.css. Mobile-first
 * (primary users are Android WebView). Screen-specific styling lives in
 * the per-screen stylesheets added in 5c–5e, not here.
 *
 * Load order: tokens.css -> fonts.css -> base.css.
 */

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

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--serif);
  color: var(--ink);
  font-weight: 600;
  line-height: 1.2;
}

p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
svg,
picture {
  display: block;
  max-width: 100%;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

/* Mono is reserved for eyebrow labels and tabular metadata. */
.eyebrow {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Bottom tab nav — design/screens shows this on every authed screen.
 * Fixed to viewport bottom; the :has() rule below reserves space on any
 * page that renders the nav so screen content isn't covered. Pre-auth
 * screens (manifesto, login) skip rendering it entirely. */
.tabnav {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 50;
  background: var(--bg);
  border-top: 1px solid var(--rule);
  padding-bottom: env(safe-area-inset-bottom);
}

/* Items match the 600px content column on desktop while the bar itself
 * spans the viewport edge-to-edge (so the top border looks continuous). */
.tabnav__inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  max-width: 600px;
  margin: 0 auto;
}

/* §7d — icon-above-label layout. Each item is a flex column: 18px glyph
 * (or avatar disc on the Me slot) on top, uppercase label below. The
 * `currentColor` inside the SVGs picks up the item's `color`, so the
 * is-active rule re-tints the glyph at the same time as the label. */
.tabnav__item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 60px;
  padding: 6px 0;
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--text-3);
  text-decoration: none;
}

.tabnav__glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
}

/* Me-slot avatar disc — warm-tan background, initial in paper-light.
 * The active ring is a 1.5px solid box-shadow in the accent color so it
 * sits flush around the disc without resizing it. Matches the
 * `<Avatar>` atom in design/2026-05-22/shell.jsx. */
.tabnav__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: oklch(0.78 0.10 60);
  color: #faf7f0;
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 9px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
  overflow: hidden;
}

.tabnav__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tabnav__avatar--ring {
  box-shadow: 0 0 0 1.5px var(--accent);
}

.tabnav__label {
  line-height: 1;
}

.tabnav__item.is-active {
  color: var(--ink);
  font-weight: 600;
}

.tabnav__item.is-active::after {
  content: "";
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

/* Me slot suppresses the active underdot — the ring around the avatar
 * is the active affordance, the dot would double up. */
.tabnav__item--me.is-active::after {
  content: none;
}

body:has(.tabnav) {
  padding-bottom: calc(60px + env(safe-area-inset-bottom));
}
