/* Life HQ — reset, page shell, typography, bottom navigation. */

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

html {
  -webkit-text-size-adjust: 100%;
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

/* Subtle paper grain — atmosphere without weight. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.28;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-optical-sizing: auto;
  letter-spacing: -0.014em;
  margin: 0;
  text-wrap: balance;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }

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

.num { font-variant-numeric: tabular-nums; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* ---------- app shell ----------------------------------------------------- */

#app {
  position: relative;
  z-index: 1;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + var(--sp-5));
}

.screen {
  padding: 0 var(--gutter);
  max-width: 46rem;
  margin: 0 auto;
  animation: screen-in var(--dur) var(--ease-out-expo) both;
}

@keyframes screen-in {
  from { opacity: 0; transform: translate3d(0, 10px, 0); }
  to   { opacity: 1; transform: none; }
}

/* ---------- page masthead ------------------------------------------------- */

.masthead {
  padding: calc(var(--safe-t) + var(--sp-6)) 0 var(--sp-4);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
}

.masthead__eyebrow {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  margin: 0 0 var(--sp-1);
}

.masthead h1 { font-size: var(--text-xl); line-height: 1.05; }

/* ---------- bottom navigation --------------------------------------------- */

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: var(--sp-2) var(--sp-2) calc(var(--sp-2) + var(--safe-b));
  background: oklch(97.4% 0.009 84 / 0.86);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--rule);
}

.tab {
  appearance: none;
  border: 0;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: var(--sp-2) 0 var(--sp-1);
  border-radius: var(--r-md);
  color: var(--ink-faint);
  font-size: 0.6875rem;
  letter-spacing: 0.01em;
  transition: color var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease);
  text-decoration: none;
}

.tab svg { width: 22px; height: 22px; stroke-width: 1.6; }
.tab:active { transform: scale(0.93); }
.tab[aria-current='page'] { color: var(--accent); }
.tab[aria-current='page'] .tab__dot { opacity: 1; transform: none; }

.tab__dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}

/* ---------- offline / status banner --------------------------------------- */

.wire {
  position: fixed;
  top: calc(var(--safe-t) + var(--sp-2));
  left: 50%;
  transform: translate(-50%, -160%);
  z-index: 60;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--paper);
  font-size: var(--text-sm);
  box-shadow: var(--shadow-lift);
  transition: transform var(--dur) var(--ease-out-expo);
  max-width: calc(100vw - 2rem);
}
.wire[data-show='1'] { transform: translate(-50%, 0); }
