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

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

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Decorative pharmacy background pattern */
#app {
  position: relative;
}

#app::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: var(--bg-pattern-image);
  background-size: calc(max(100vw, 148vh) + 56px) auto;
  background-position: calc(50% - 28px) 30%;
  background-repeat: no-repeat;
  opacity: var(--bg-pattern-opacity);
  z-index: 0;
  pointer-events: none;
}

#app > * {
  position: relative;
  z-index: 1;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

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

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--spacing-sm) var(--spacing-md);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent);
}

h1, h2, h3, h4 {
  line-height: 1.3;
  font-weight: 600;
  text-wrap: balance;
}

h1,
h2 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.04em;
}

h1 { font-size: clamp(2.2rem, 4vw, 3.9rem); line-height: 0.96; }
h2 { font-size: clamp(1.55rem, 2.4vw, 2.35rem); }
h3,
h4 {
  font-family: var(--font-body);
  letter-spacing: -0.02em;
}
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }

/* Screen-reader only utility */
.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;
}

p { margin-bottom: var(--spacing-sm); }
p:last-child { margin-bottom: 0; }

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

::selection {
  background: var(--accent-dim);
  color: var(--text-primary);
}
