/* Kin First Clinic — app chrome only.
   The base site stylesheet (/style.css) is loaded first and carries the
   palette and components; this file carries only what the standalone
   app shell adds: the app bar, the fixed bottom tab bar, case chips,
   the install banner, and big tappable case cards. */

.app-body {
  background: var(--cream);
  padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
}

/* ---------- sticky top app bar ---------- */
.app-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--maroon);
  color: var(--cream);
  padding: 0.55rem 1rem;
  padding-top: calc(0.55rem + env(safe-area-inset-top, 0px));
  box-shadow: 0 2px 10px rgba(64, 6, 24, 0.35);
}
.app-bar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--cream);
  text-decoration: none;
  min-height: 48px;
}
.app-bar-brand:visited { color: var(--cream); }
.app-bar-seal { width: 42px; height: 42px; border-radius: 50%; flex: none; }
.app-bar-words { display: flex; flex-direction: column; line-height: 1.15; }
.app-bar-name {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.app-bar-name .gold { color: var(--gold); }
.app-bar-sub { font-size: 0.78rem; color: var(--gold-soft); letter-spacing: 0.04em; }
.app-bar-action {
  color: var(--cream);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  border: 1px solid var(--gold);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  flex: none;
}
.app-bar-action:visited { color: var(--cream); }

/* ---------- main column: clears the fixed tab bar ---------- */
.app-main {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1.1rem 1rem 1.5rem;
  width: 100%;
}
@media (min-width: 760px) { .app-main { max-width: 46rem; padding-top: 1.5rem; } }

.app-footer { margin-top: 2rem; text-align: center; }
.app-footer .fineprint { font-size: 0.78rem; line-height: 1.55; color: var(--muted); }

/* ---------- fixed bottom tab bar ---------- */
.app-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  background: var(--cream);
  border-top: 2px solid var(--gold);
  box-shadow: 0 -2px 10px rgba(64, 6, 24, 0.12);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.app-tabbar a {
  flex: 1 1 0;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  padding: 0.4rem 0.2rem 0.5rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.82rem;
  line-height: 1.2;
  border-bottom: 3px solid transparent;
}
.app-tabbar a .ic { font-size: 1.35rem; line-height: 1; }
.app-tabbar a.here {
  color: var(--maroon);
  font-weight: 700;
  border-bottom: 3px solid var(--gold);
}

/* ---------- horizontal case-tab chip row ---------- */
.app-case-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.25rem 0.1rem 0.6rem;
  margin: 0.5rem 0 1rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.app-case-tabs::-webkit-scrollbar { display: none; }
.app-case-tabs a {
  flex: none;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--maroon-dark);
  text-decoration: none;
  font-size: 0.95rem;
  white-space: nowrap;
}
.app-case-tabs a.here {
  background: var(--maroon);
  color: #fff;
  border-color: var(--maroon);
  font-weight: 700;
}

/* ---------- install banner ---------- */
.install-banner {
  max-width: 44rem;
  margin: 0.9rem auto 0;
  padding: 0 1rem;
}
@media (min-width: 760px) { .install-banner { max-width: 46rem; } }
.install-banner[hidden] { display: none; }
.install-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
.install-card p { margin: 0.3rem 0 0.7rem; }
.install-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }

/* ---------- big tappable case cards ---------- */
.app-case-card {
  display: block;
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 6px solid var(--gold);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  margin: 0.9rem 0;
  color: var(--ink);
  text-decoration: none;
  min-height: 76px;
}
.app-case-card:visited { color: var(--ink); }
.app-case-card .case-name {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--maroon);
  display: block;
  margin-bottom: 0.25rem;
}
.app-case-card .case-meta { color: var(--muted); font-size: 0.95rem; display: block; }

/* ---------- app stat grid (mirrors .statgrid where a page needs it) ---------- */
.app-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; margin: 1rem 0; }
@media (min-width: 760px) { .app-stat-grid { grid-template-columns: repeat(3, 1fr); } }
