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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  font-size: var(--font-md);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg-gradient), var(--bg);
  background-attachment: fixed;
  min-height: calc(100 * var(--vh));
  min-height: calc(100 * var(--dvh));
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
  line-height: 1.25;
}

button, .btn, .tab, .nav-item, .sidebar-item, .list-card, .qty-btn, a {
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}

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

::selection {
  background: var(--primary);
  color: #FFFFFF;
}

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

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

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

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  list-style: none;
}

#app {
  min-height: calc(100 * var(--vh));
  min-height: calc(100 * var(--dvh));
  display: flex;
  flex-direction: column;
}

/* The main landmark wraps the screen stack so assistive technology can jump
   straight to the content. It inherits the column layout #app used to give the
   screens directly, so nothing moves. */
#app-main {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

/* Section 7 B5 (WCAG 2.4.1): keyboard users must be able to bypass the navigation. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 9999;
  padding: 10px 16px;
  background: var(--primary);
  color: var(--on-brand);
  font-weight: 700;
  border-radius: 0 0 8px 0;
  text-decoration: none;
}
.skip-link:focus {
  left: 0;
}

/* Section 7 B5 (WCAG 2.5.8): a tap target must be at least 24x24 px. */
.quick-link {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 0;
}

.screen {
  display: none;
  flex: 1;
  padding: var(--space-md);
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  max-width: 100%;
  animation: fadeIn var(--transition-normal) ease;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes slideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.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;
}
