/* Family site. Sizes in rem so browser zoom and text-size settings scale everything;
   base text 1.25rem (20 px at the default 16 px), never under 18 px. Targets at least
   44 x 44 px (2.75rem). One column, so 200% and 400% zoom only reflow. Colors pass
   WCAG AA contrast in both schemes (checked in the PR). */

:root {
  --bg: #fbf8f3;
  --surface: #ffffff;
  --text: #1f1a14;
  --muted: #4a4036;
  --link: #6a3b12;
  --border: #8a7a68;
  --accent: #6a3b12;
  --accent-text: #ffffff;
  --danger: #8f1d14;
  --error: #8f1d14;
  --focus: #1a5fb4;
  --done: #1e5e2a;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1714;
    --surface: #24201c;
    --text: #f3ede4;
    --muted: #d6cbbd;
    --link: #f0c08a;
    --border: #a39482;
    --accent: #f0c08a;
    --accent-text: #1a1714;
    --danger: #ffb4a9;
    --error: #ffb4a9;
    --focus: #8cc4ff;
    --done: #9bd8a4;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1.25rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

main,
.bar,
.site-header nav,
.site-footer {
  max-width: 40rem;
  margin: 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

main {
  padding-top: 1.5rem;
  padding-bottom: 3rem;
}

main:focus {
  outline: none;
}

h1 {
  font-size: 2.125rem;
  line-height: 1.2;
  margin: 0.5rem 0 1rem;
}

h2 {
  font-size: 1.625rem;
  line-height: 1.25;
  margin: 2rem 0 0.75rem;
}

h1:focus,
h2:focus {
  outline: none;
}

h1:focus-visible,
h2:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

p {
  margin: 0 0 1rem;
}

a {
  color: var(--link);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

/* Visible focus on everything that takes it (WCAG 2.4.7, 2.4.11). */
a:focus-visible,
button:focus-visible,
input:focus-visible,
dialog :focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

/* ----- header and footer ----- */

.site-header {
  border-bottom: 1px solid var(--border);
}

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.brand {
  margin: 0;
  font-weight: 700;
}

.brand .section {
  font-weight: 400;
  color: var(--muted);
}

.who {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.signed-in {
  margin: 0;
  color: var(--muted);
}

.site-header nav {
  padding-bottom: 0.5rem;
}

.site-header nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  padding-bottom: 2rem;
  color: var(--muted);
}

.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -10rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  z-index: 10;
}

.skip:focus {
  top: 0.5rem;
}

/* ----- controls ----- */

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  min-width: 2.75rem;
  padding: 0.5rem 1.25rem;
  border: 2px solid var(--accent);
  border-radius: 0.5rem;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

button.secondary {
  background: transparent;
  color: var(--link);
}

button.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--accent-text);
}

button[aria-disabled="true"] {
  opacity: 0.75;
  cursor: progress;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0;
}

form {
  margin: 1.5rem 0;
}

label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

input {
  display: block;
  width: 100%;
  max-width: 28rem;
  min-height: 3rem;
  padding: 0.5rem 0.75rem;
  margin: 0.25rem 0 0.75rem;
  border: 2px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

input.code {
  max-width: 14rem;
  font-size: 1.625rem;
  letter-spacing: 0.15em;
}

input[aria-invalid="true"] {
  border-color: var(--error);
  border-width: 3px;
}

.hint {
  color: var(--muted);
}

.error {
  color: var(--error);
  font-weight: 700;
}

.error:empty,
.status-line:empty {
  margin: 0;
}

.notice {
  border-left: 4px solid var(--accent);
  padding: 0.5rem 1rem;
  background: var(--surface);
}

.loading {
  color: var(--muted);
}

/* ----- Your family's stories ----- */

.cards,
.people,
.checklist,
.plain {
  list-style: none;
  padding: 0;
  margin: 0;
}

.card {
  border: 2px solid var(--border);
  border-radius: 0.75rem;
  background: var(--surface);
  padding: 1rem 1.25rem;
  margin: 0 0 1rem;
}

.card h2 {
  margin-top: 0;
}

.card-status {
  margin: 0 0 0.25rem;
  font-weight: 700;
}

/* ----- stories ----- */

.conversation {
  border-top: 2px solid var(--border);
  margin-top: 2rem;
}

.count {
  color: var(--muted);
}

.turn {
  margin: 0 0 1.75rem;
}

.label {
  display: block;
  font-weight: 700;
  margin: 0;
}

.q {
  color: var(--muted);
}

.a p:not(.label) {
  margin-bottom: 0.75rem;
}

.to-top {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
}

/* The browser's player is about 300 px wide by default: at 400% zoom (a 320 px
   viewport) that would scroll sideways, so it follows the column instead. */
.listen audio {
  display: block;
  width: 100%;
  max-width: 28rem;
  min-height: 2.75rem;
}

.pdf {
  border: 2px solid var(--border);
  border-radius: 0.75rem;
  background: var(--surface);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}

.pdf-result .button-link {
  margin-bottom: 0.5rem;
}

/* ----- manager view ----- */

.check {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.check-icon {
  font-weight: 700;
  min-width: 1.5rem;
}

.check.done .check-icon,
.check.done .check-status {
  color: var(--done);
}

.check-text {
  flex: 1 1 16rem;
}

.check .hint {
  flex-basis: 100%;
  margin: 0;
}

.person {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

dialog.confirm {
  max-width: min(36rem, calc(100vw - 2rem));
  border: 2px solid var(--border);
  border-radius: 0.75rem;
  background: var(--surface);
  color: var(--text);
  padding: 1.25rem 1.5rem;
}

dialog.confirm h2 {
  margin-top: 0;
}

dialog::backdrop {
  background: rgb(0 0 0 / 55%);
}

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

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
