/* PrimaryCare FAST — Base */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
  min-height: 100vh;
  min-height: 100dvh;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

img, svg, canvas, video { display: block; max-width: 100%; }

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-700); text-decoration: underline; }

button { font-family: inherit; }

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

h1, h2, h3, h4 { margin: 0; font-weight: var(--sja-weight-semibold); line-height: 1.25; color: var(--color-text); }
h1 { font-size: var(--fs-h1); font-weight: var(--sja-weight-bold); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }

p { margin: 0; }

ul, ol { margin: 0; padding-left: 1.25em; }

:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-radius: var(--radius-sm);
}

::selection { background: rgba(0, 159, 77, 0.22); color: inherit; }

/* Highlight style (aligned to SJA “highlight” motif) */
.highlight {
  background-color: var(--sja-yellow);
  color: var(--sja-black);
  padding: 0.1em 0.25em;
  border-radius: 3px;
  display: inline-block;
}

/* App layout */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: calc(var(--header-h) + var(--safe-top));
  padding-top: var(--safe-top);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding-left: var(--sp-md);
  padding-right: var(--sp-md);
}

.app-main {
  flex: 1;
  display: block;
  padding: var(--sp-md);
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + var(--sp-xl));
  width: 100%;
  max-width: var(--max-content);
  margin: 0 auto;
}

.tab-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 60;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}

.modal-root { position: fixed; inset: 0; pointer-events: none; z-index: 100; }
.modal-root[aria-hidden="false"] { pointer-events: auto; }

.toast-root {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + var(--sp-md));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  z-index: 110;
  pointer-events: none;
}

/* Splash */
.splash {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-700) 100%);
  color: var(--color-on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  transition: opacity var(--t-slow) var(--ease);
}
.splash.hide { opacity: 0; pointer-events: none; }
.splash-inner { text-align: center; }
.splash-logo { width: 96px; height: 96px; margin: 0 auto var(--sp-md); animation: pulse 1.6s ease-in-out infinite; }
.splash-name { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
.splash-tag { margin-top: 6px; opacity: 0.85; font-size: 14px; }

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.85; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
