/* css/base.css
   Global reset + shared patterns for every system EXCEPT landing.
   Landing overrides body spacing itself via body.landing-active in
   landing.css, so nothing here needs to special-case it.

   body keeps a mobile-safe default width/padding as a fallback for
   any system that hasn't set its own container width yet — but this
   default is REMOVED at tablet/desktop widths, so systems that DO
   define their own responsive container (.home-root, .trace-wrapper,
   using the --content-max-* variables from shared.css) are free to
   use full available width on larger screens instead of being capped
   at 480px everywhere.

   overflow-x: hidden here is a single, central safeguard against any
   page-level horizontal scroll caused by content overflowing its
   container (long unbroken text, a too-wide image, etc.) — applied
   once, so no individual system needs to repeat it.
*/

/* ---------- reset ---------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* The hidden attribute must always win. Without this, any class that sets
   display (flex, inline-flex, grid) silently overrides it, which is how
   "hidden" menus, badges and footer actions end up showing. */
[hidden] {
  display: none !important;
}

body {
  font-family: 'Work Sans', system-ui, sans-serif;
  max-width: 480px;
  margin: 40px auto;
  padding: 0 20px;
  background: var(--color-off-white, #f7f7fa);
  color: var(--color-charcoal, #1e2126);
  line-height: 1.5;
}

/* ---------- media ---------- */
img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

@media (min-width: 641px) {
  body {
    max-width: none;
    margin: 0;
    padding: 0;
  }
}

h1, h2, h3, p {
  margin: 0 0 0.6em 0;
}

/* ---------- nav ---------- */
nav {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}
nav a {
  text-decoration: none;
  color: var(--color-navy, #001f54);
  font-weight: 600;
}
nav a:hover {
  text-decoration: underline;
}

/* ---------- forms (login, signup, and future systems) ---------- */
form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
input, textarea, select {
  padding: 10px;
  font-size: 16px;
  border: 1px solid var(--color-border, #ccc);
  border-radius: 6px;
  font-family: inherit;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--color-navy, #001f54);
  outline-offset: 1px;
}

button {
  padding: 10px;
  font-family: inherit;
  font-size: 16px;
  background: var(--color-navy, #001f54);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
button:hover {
  opacity: 0.9;
}
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---------- shared error/status text ----------
   Lighter red than before: #b3261e is hard to read on the dark theme. */
[role="alert"] {
  color: var(--danger-text, #f87171);
  font-size: 0.9rem;
  min-height: 1.2em;
}