/* Jefferson Line — passenger PWA styles.
   A1 no color-only signals · A2 every pair below is gated by
   tools/contrast-check.mjs · A3 visible focus · A4 reduced motion honored ·
   A6 light and dark both first-class · A8 relative units throughout. */

:root {
  --bg: #f4f1ea;
  --surface: #ffffff;
  --text: #1c2733;
  --muted: #4d5a66;
  --accent: #1b3a5b;
  --accent-text: #ffffff;
  --focus: #8a5a00;
  --danger: #8f2136;
  --danger-text: #ffffff;
  --line: #8b8577;
  --badge: #dfe7ee;
  --badge-text: #1c2733;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10161d;
    --surface: #1a222c;
    --text: #e8e4da;
    --muted: #a9b2bc;
    --accent: #8db8e2;
    --accent-text: #10161d;
    --focus: #ffd166;
    --danger: #f2a0ae;
    --danger-text: #10161d;
    --line: #6d7885;
    --badge: #2a3542;
    --badge-text: #e8e4da;
  }
}

* { box-sizing: border-box; }

html { font-size: 100%; } /* A8: follow the device's text size */

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.45;
  min-height: 100vh;
}

/* A3: focus is always visible, on everything. */
:focus-visible {
  outline: 0.2rem solid var(--focus);
  outline-offset: 0.15rem;
}

/* A4: motion is optional. Nothing depends on animation to be understood. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

header.app {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1rem; border-bottom: 0.125rem solid var(--line);
  background: var(--surface);
  flex-wrap: wrap;
}
header.app h1 { font-size: 1.15rem; margin: 0; flex: 1 1 auto; }

main { max-width: 44rem; margin: 0 auto; padding: 1rem; }

button, .button {
  font: inherit;
  background: var(--accent); color: var(--accent-text);
  border: none; border-radius: 0.5rem;
  padding: 0.65rem 1rem; min-height: 2.75rem; min-width: 2.75rem; /* A5 target size */
  cursor: pointer; text-decoration: none; display: inline-block;
}
button.quiet {
  background: var(--surface); color: var(--text);
  border: 0.0625rem solid var(--line);
}
button.danger { background: var(--danger); color: var(--danger-text); }
button:disabled { opacity: 0.55; cursor: not-allowed; }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 0.0625rem solid var(--line); border-radius: 0.4rem;
  padding: 0.6rem; min-height: 2.75rem; width: 100%;
}
label { display: block; margin: 0.75rem 0 0.25rem; font-weight: 600; }
fieldset { border: 0.0625rem solid var(--line); border-radius: 0.5rem; margin: 1rem 0; }

/* Watches: morning / afternoon / evening bands of THE DAY (Section 1). */
section.watch { margin: 1.25rem 0; }
section.watch > h2 {
  font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); border-bottom: 0.0625rem solid var(--line);
  padding-bottom: 0.25rem;
}

article.item {
  background: var(--surface); border: 0.0625rem solid var(--line);
  border-radius: 0.6rem; padding: 0.75rem 1rem; margin: 0.6rem 0;
}
article.item h3 { margin: 0 0 0.25rem; font-size: 1.05rem; }
article.item .when { color: var(--muted); font-size: 0.9rem; }
article.item .note { margin: 0.4rem 0 0; }

/* A1: every state is glyph + text, never hue alone. */
.badge {
  display: inline-block; background: var(--badge); color: var(--badge-text);
  border-radius: 0.4rem; padding: 0.15rem 0.5rem; font-size: 0.85rem;
  font-weight: 600; margin-right: 0.4rem;
}

/* Availability grid: three states for another person, distinguishable in
   grayscale and by a screen reader (glyph AND label in markup). */
.grid-cell { padding: 0.5rem; border: 0.0625rem solid var(--line); border-radius: 0.4rem; }

dialog {
  background: var(--surface); color: var(--text);
  border: 0.125rem solid var(--line); border-radius: 0.75rem;
  max-width: 34rem; width: calc(100vw - 2rem);
  padding: 1rem 1.25rem;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }

/* The standing update strip (§7h): the new version WAITS; the reader is told. */
#update-strip {
  background: var(--badge); color: var(--badge-text);
  padding: 0.6rem 1rem; display: flex; gap: 0.75rem; align-items: center;
  border-bottom: 0.125rem solid var(--line);
}
#update-strip[hidden] { display: none; }

/* Two-timestamp sync control (Section 9). */
#sync-meta { color: var(--muted); font-size: 0.85rem; }

nav.tabs { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.75rem 0; }
nav.tabs a {
  color: var(--text); background: var(--surface);
  border: 0.0625rem solid var(--line); border-radius: 0.5rem;
  padding: 0.5rem 0.9rem; min-height: 2.75rem; display: inline-flex; align-items: center;
  text-decoration: none;
}
nav.tabs a[aria-current="page"] {
  background: var(--accent); color: var(--accent-text);
  /* A1: the current tab is also marked in text by aria-current and the ▸ glyph
     the JS inserts, not by color alone. */
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

footer.app {
  max-width: 44rem; margin: 2rem auto 1rem; padding: 0 1rem;
  color: var(--muted); font-size: 0.9rem;
}
footer.app a { color: inherit; }

hr { border: none; border-top: 0.0625rem solid var(--line); }
