/* ==========================================================================
   BASE LAYOUT
   Body, container, header, footer
   ========================================================================== */

html {
  overflow-y: scroll;
  /* Reserve scrollbar width so layout doesn't shift when content loads */
  scrollbar-gutter: stable;
  /* Reserve gutter to prevent layout shift when scrollbar appears */
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  background: #f8fafc;
  color: #222;
  line-height: var(--line-height-base, 1.5);
  padding: 0 0 40px 0;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  width: 100% !important;
  /* Force 100% width immediately to prevent layout shift */
  max-width: 100% !important;
  /* Never exceed viewport on mobile */
  box-sizing: border-box !important;
  /* Include padding in width calculation */
  overflow-x: hidden !important;
  /* Prevent horizontal scroll initially */
  min-width: 0;
  /* Prevent expansion beyond viewport */
}

header {
  text-align: center;
  margin-bottom: 1.5rem;
}

/* PWA standalone mode: Add safe area inset padding to header */
.pwa-standalone header {
  padding-top: env(safe-area-inset-top, 0px);
}

/* Reduce h1 top margin in PWA mode since header already has safe area padding */
.pwa-standalone header h1 {
  margin-top: 1rem;
}

h1 {
  text-align: center;
  margin: 2rem 0 1.5rem 0;
  font-size: 2.2rem;
  font-weight: var(--font-weight-bold, 700);
  letter-spacing: -1px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-large, 0.75rem);
}

.site-logo {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: contain;
  flex-shrink: 0;
}

footer {
  margin-top: 2rem;
  text-align: center;
  color: #888;
  font-size: 0.95em;
  padding: 1rem 0;
}

footer p {
  margin: 0;
}

footer a {
  color: #2563eb !important;
  text-decoration: none;
  transition: color 0.2s ease;
}

footer a:hover,
footer a:focus {
  color: #1d4ed8 !important;
  text-decoration: underline;
}

/* Mobile responsive - Mobile-first approach */
@media (max-width: 479px) {
  body {
    padding: 0 0 20px 0;
  }

  .container {
    padding: 0;
    width: 100%;
    margin: 0 auto;
  }

  h1 {
    font-size: 1.5rem;
    margin: 1rem 0 0.75rem 0;
    gap: var(--gap-standard, 0.5rem);
  }

  .site-logo {
    width: 32px;
    height: 32px;
  }

  /* Reduce h1 top margin in PWA mode on mobile */
  .pwa-standalone header h1 {
    margin-top: 0.5rem;
  }
}