:root {
  --ink: #173f3a;
  --ink-soft: #46645f;
  --mist: #edf1ef;
  --paper: #ffffff;
  --line: #cfd9d5;
  --marigold: #e2a12b;
  --marigold-soft: #fbefd6;
  --plum: #6e3b5e;
  --error: #a3312a;
  --radius: 10px;
  --body: "Atkinson Hyperlegible", system-ui, sans-serif;
  --head: "Bricolage Grotesque", "Atkinson Hyperlegible", sans-serif;
}

* { box-sizing: border-box; }
html { font-size: 112.5%; } /* 18px base: easier for older readers and caregivers */
body {
  margin: 0;
  background: var(--mist);
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.55;
}

.banner {
  background: var(--marigold-soft);
  border-bottom: 1px solid var(--marigold);
  padding: 0.6rem 1rem;
  text-align: center;
  font-size: 0.9rem;
}

.layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2.5rem 1rem 4rem;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 3rem;
  align-items: start;
}

h1, h2, h3 { font-family: var(--head); line-height: 1.12; margin: 0; }
h1 { font-size: clamp(2rem, 4vw, 2.9rem); font-weight: 800; letter-spacing: -0.02em; max-width: 14ch; }
.lede { color: var(--ink-soft); max-width: 46ch; margin: 1rem 0 2rem; }

/* ---------- form ---------- */
.profile { display: grid; gap: 1rem; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
label { display: grid; gap: 0.3rem; font-weight: 700; font-size: 0.92rem; }
input:not([type="radio"]) {
  font: inherit;
  font-weight: 400;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 0.65rem 0.8rem;
  width: 100%;
}
input:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 3px solid var(--marigold);
  outline-offset: 2px;
}
.hint { font-weight: 400; color: var(--ink-soft); font-size: 0.85rem; margin: 0; }
.lang { border: 0; padding: 0; margin: 0; display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.lang legend { font-weight: 700; font-size: 0.92rem; padding: 0; margin-bottom: 0.3rem; width: 100%; }
.choice { display: inline-flex; flex-direction: row; align-items: center; gap: 0.4rem; font-weight: 400; }
.choice input { accent-color: var(--ink); width: 1.1rem; height: 1.1rem; }

.actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.25rem; }
button {
  font: inherit;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.75rem 1.4rem;
  cursor: pointer;
  border: 2px solid var(--ink);
}
.primary { background: var(--ink); color: var(--paper); }
.primary:hover { background: #0f2e2a; }
.primary[aria-busy="true"] { opacity: 0.75; cursor: progress; }
.ghost { background: transparent; color: var(--ink); }
.ghost:hover { background: var(--paper); }
.small { padding: 0.35rem 0.9rem; font-size: 0.85rem; }
.error { color: var(--error); font-weight: 700; margin: 0; }

/* ---------- result ---------- */
.result { min-height: 20rem; }
.empty {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  color: var(--ink-soft);
  max-width: 40ch;
}
.session { background: var(--paper); border-radius: 16px; padding: 2rem 2rem 1.5rem; box-shadow: 0 1px 0 var(--line); }
.session-head { display: grid; gap: 0.9rem; margin-bottom: 1.75rem; }
.session-title { font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 800; }
.session-tools { display: flex; gap: 1.1rem; align-items: center; flex-wrap: wrap; font-size: 0.85rem; color: var(--ink-soft); }
.session-tools button { margin-left: auto; }
.key { display: inline-flex; align-items: center; gap: 0.4rem; }
.dot { width: 0.7rem; height: 0.7rem; border-radius: 50%; display: inline-block; flex: none; }
.dot.family { background: var(--ink); }
.dot.qloo { background: var(--plum); }

/* The programme: a timed sequence on a marigold rail */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  left: 0.55rem;
  top: 0.6rem;
  bottom: 0.6rem;
  width: 4px;
  border-radius: 4px;
  background: var(--marigold);
}
.segment { position: relative; padding: 0 0 1.75rem 2.4rem; }
.segment::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.35rem;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: var(--paper);
  border: 4px solid var(--marigold);
}
.segment.notes::before { border-color: var(--ink); }
.segment h3 { font-size: 1.15rem; font-weight: 600; margin-bottom: 0.4rem; }
.segment p { margin: 0 0 0.5rem; max-width: 60ch; }
.segment ul { margin: 0.3rem 0 0.6rem; padding-left: 1.1rem; }
.segment li { margin: 0.2rem 0; }
.chips { list-style: none; padding: 0 !important; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  display: inline-flex; align-items: center; gap: 0.45rem;
  border: 1.5px solid var(--line); border-radius: 999px;
  padding: 0.3rem 0.85rem; font-size: 0.95rem; margin: 0 !important;
}
.chip.qloo { border-color: #d7c3d0; }
.extra { font-weight: 700; margin-top: 0.75rem !important; }
.notes-box { background: var(--mist); border-radius: var(--radius); padding: 1rem 1.2rem; }
.notes-box ul { margin: 0; }

.who { margin: 0.4rem 0 0.6rem; font-size: 0.92rem; }
.who summary { cursor: pointer; font-weight: 700; color: var(--plum); }
.who-list { margin: 0.5rem 0 0; padding-left: 1.1rem; color: var(--ink-soft); }
.who-list li { margin: 0.35rem 0; }
.who-list strong { color: var(--ink); }
.places { list-style: none; padding: 0 !important; display: grid; gap: 0.6rem; margin-top: 0.5rem !important; }
.place {
  display: grid; gap: 0.15rem; margin: 0 !important;
  border: 1.5px solid #d7c3d0; border-left: 5px solid var(--plum);
  border-radius: var(--radius); padding: 0.65rem 0.9rem; background: var(--paper);
}
.place .addr { color: var(--ink-soft); font-size: 0.88rem; }
.place .desc { font-size: 0.88rem; }
.place .map { font-size: 0.85rem; font-weight: 700; color: var(--plum); justify-self: start; }
.waiting p { font-weight: 700; color: var(--ink); }
.waiting p::before { content: ""; display: inline-block; width: 0.7rem; height: 0.7rem; margin-right: 0.6rem; border-radius: 50%; background: var(--marigold); animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: 0.3; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .waiting p::before { animation: none; } }
.trace-args { display: block; font-size: 0.8rem; color: var(--ink-soft); }
.trace { margin-top: 0.5rem; border-top: 1px solid var(--line); padding-top: 1rem; font-size: 0.9rem; }
.trace summary { cursor: pointer; font-weight: 700; }
.trace-list { margin: 0.8rem 0 0; padding-left: 1.2rem; color: var(--ink-soft); }
.trace-list li { margin-bottom: 0.5rem; }
.trace code { font-size: 0.8rem; background: var(--mist); padding: 0.05rem 0.35rem; border-radius: 4px; }

.reveal { animation: reveal 0.5s ease-out both; }
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .reveal { animation: none; } }

@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; gap: 2rem; padding-top: 1.5rem; }
  .session { padding: 1.5rem 1.1rem 1rem; }
}
@media (max-width: 480px) { .row { grid-template-columns: 1fr; } }

@media print {
  body { background: #fff; }
  .intro, .banner, .trace, .session-tools button, .place .map { display: none !important; }
  .who { display: block; } .who-list { display: block; }
  .layout { display: block; padding: 0; }
  .session { box-shadow: none; padding: 0; }
}
