/* Children's portal (spec 12.2).

   Tone: warm, short, friendly. Large type, one thought per screen, big
   buttons, calm colours, no warning red, nothing that looks like an
   authority. Strict CSP (style-src 'self'): no inline styles, no script.
   Works from 320 px; checked at 390 px and 1280 px. */

:root {
  --ink: #1f2933;
  --muted: #4a5561; /* 7.4:1 on the background */
  --bg: #fbf7f0;
  --card: #ffffff;
  --sea: #24617f; /* 6.4:1 with white text */
  --sea-deep: #184a63;
  --sea-soft: #e3eff4;
  --sun: #f4c95d;
  --sun-soft: #fff4d6;
  --leaf: #2f6b45; /* 6.3:1 on white */
  --leaf-soft: #e4f2e7;
  --plum: #6b3f69; /* for important notes instead of red */
  --plum-soft: #f5e9f4;
  --line: #ddd5c8;
  --line-strong: #6f7782; /* 4.6:1: borders of inputs */
  --focus: #1b4f9c;
  --radius: 18px;
  --sans: "Source Sans 3", "Segoe UI", Helvetica, Arial, sans-serif;
  --round: "Source Serif 4", Georgia, serif;
  --gutter: max(16px, env(safe-area-inset-left, 0px));
}

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

html {
  background: var(--bg);
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--sans);
  font-size: 1.1875rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--sea);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--sea-deep);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 6px;
}

h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0 0 0.6em;
  font-weight: 600;
}

h1 {
  font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.25rem);
}

h2 {
  font-size: 1.35rem;
}

h3 {
  font-size: 1.2rem;
}

p {
  margin: 0 0 0.9em;
}

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--card);
  padding: 0.6rem 1rem;
  z-index: 10;
}

.skip-link:focus {
  left: var(--gutter);
}

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

.lead {
  font-size: 1.25rem;
}

/* Header ------------------------------------------------------------------------ */

.top {
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.top__inner,
.langs,
.progress,
.main,
.foot__inner {
  width: 100%;
  max-width: 46rem;
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.top__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding-top: 0.7rem;
  padding-bottom: 0.4rem;
}

.top__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.15rem;
  min-width: 0;
}

.top__icon {
  border-radius: 12px;
  flex: none;
}

.top__name {
  overflow-wrap: anywhere;
}

.top__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.inline-form {
  display: inline;
  margin: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.35rem 0.95rem;
  border-radius: 999px;
  border: 2px solid var(--sea);
  background: var(--card);
  color: var(--sea);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.pill--help {
  background: var(--sun);
  border-color: var(--sun);
  color: var(--ink);
}

.pill--pause {
  background: var(--sea-soft);
}

/* Read aloud (spec 5.1): hidden until the device offers a local voice. */
.pill[hidden] {
  display: none;
}

.pill--read[aria-pressed="true"] {
  background: var(--sea);
  color: var(--card);
}

.langs {
  padding-bottom: 0.5rem;
}

.langs__set {
  border: 0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.langs__button {
  font: inherit;
  font-size: 0.95rem;
  background: none;
  border: 0;
  color: var(--sea);
  padding: 0.35rem 0.5rem;
  min-height: 2.5rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.langs__button[aria-current="true"] {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

/* Progress of the report flow --------------------------------------------------- */

.progress {
  padding-top: 0.9rem;
}

.progress__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0.3rem;
}

.progress__step {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

.progress__dot {
  display: block;
  width: 100%;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--line);
}

.progress__step--done .progress__dot {
  background: var(--leaf);
}

.progress__step--current .progress__dot {
  background: var(--sea);
}

.progress__step--current {
  color: var(--ink);
  font-weight: 600;
}

@media (max-width: 560px) {
  .progress__label {
    display: none;
  }

  .progress__step--current .progress__label {
    display: block;
    position: absolute;
    left: -999px;
  }
}

/* Main ------------------------------------------------------------------------------ */

.main {
  flex: 1 0 auto;
  padding-top: 1.4rem;
  padding-bottom: 2.5rem;
}

.main:focus {
  outline: none;
}

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

.card__title {
  font-size: 1.25rem;
}

.card--soft {
  background: var(--sea-soft);
  border-color: transparent;
}

.card--done {
  background: var(--leaf-soft);
  border-color: transparent;
}

.card--urgent {
  background: var(--sun-soft);
  border: 2px solid var(--sun);
}

.card--yes {
  border-top: 6px solid var(--sea);
}

.card--no {
  border-top: 6px solid var(--line-strong);
}

.prose p:last-child {
  margin-bottom: 0;
}

.two-cols {
  display: grid;
  gap: 1rem;
}

@media (min-width: 700px) {
  .two-cols {
    grid-template-columns: 1fr 1fr;
  }
}

.list {
  margin: 0;
  padding-left: 1.2rem;
}

.list li {
  margin-bottom: 0.4rem;
}

/* Messages ------------------------------------------------------------------------ */

.notes {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.note {
  border-radius: 14px;
  padding: 0.8rem 1rem;
  margin-bottom: 0.5rem;
  background: var(--sea-soft);
}

.note--success {
  background: var(--leaf-soft);
}

.note--error,
.note--warning {
  background: var(--plum-soft);
  color: var(--plum);
  font-weight: 600;
}

.notice {
  background: var(--sun-soft);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  margin: 0 0 1rem;
}

.notice--ai {
  font-weight: 600;
}

/* Buttons ------------------------------------------------------------------------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
  margin: 1.2rem 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.25rem;
  padding: 0.6rem 1.4rem;
  border-radius: 999px;
  border: 2px solid var(--sea);
  background: var(--sea);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
}

.button:hover {
  background: var(--sea-deep);
  border-color: var(--sea-deep);
  color: #fff;
}

.button--big {
  min-height: 3.75rem;
  padding: 0.8rem 2rem;
  font-size: 1.25rem;
}

.button--quiet {
  background: var(--card);
  color: var(--sea);
}

.button--quiet:hover {
  background: var(--sea-soft);
  color: var(--sea-deep);
}

.button--small {
  min-height: 2.5rem;
  padding: 0.3rem 0.9rem;
  font-size: 1rem;
}

@media (max-width: 480px) {
  .actions .button,
  .form > .button {
    width: 100%;
  }
}

/* Start page ---------------------------------------------------------------------- */

.hero {
  padding: 0.5rem 0 1rem;
}

.hero__title {
  font-size: clamp(1.75rem, 1.3rem + 2vw, 2.6rem);
}

.hero__lead {
  font-size: 1.3rem;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 1rem 0;
}

@media (min-width: 760px) {
  .tiles {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 1rem;
  min-height: 8.5rem;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}

.tile:hover {
  border-color: var(--sea);
  color: var(--ink);
}

.tile--help {
  background: var(--sun-soft);
  border-color: var(--sun);
}

.tile__icon {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--sea-soft);
  position: relative;
}

.tile__icon::after {
  content: "";
  position: absolute;
  inset: 0.85rem;
  border-radius: 50%;
  background: var(--sea);
}

.tile__icon--bullying::after {
  border-radius: 4px;
  background: var(--sun);
}

.tile__icon--how::after {
  inset: 0.9rem 0.6rem;
  border-radius: 999px;
  background: var(--leaf);
}

.tile__icon--phone {
  background: var(--card);
}

.tile__icon--phone::after {
  background: var(--sun);
  inset: 0.7rem;
}

.emergency {
  font-weight: 600;
  background: var(--sun-soft);
  border-radius: 14px;
  padding: 0.8rem 1rem;
}

.langcheck__form {
  margin: 0 0 0.6rem;
}

/* Age band tabs -------------------------------------------------------------------- */

.bands {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 1rem;
}

.bands__label {
  font-weight: 600;
  margin-right: 0.3rem;
}

.bands__link {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--card);
  text-decoration: none;
}

.bands__link[aria-current="true"] {
  border-color: var(--sea);
  background: var(--sea);
  color: #fff;
}

/* Picture story ------------------------------------------------------------------------ */

.story {
  list-style: none;
  margin: 0;
  padding: 0;
}

.story__step {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.8rem;
}

.story__title {
  font-size: 1.2rem;
  margin-bottom: 0.3rem;
}

.story__step p {
  margin: 0;
}

.story__pic {
  flex: none;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: var(--sea-soft);
  position: relative;
}

.story__pic::after {
  content: "";
  position: absolute;
  inset: 1rem;
  border-radius: 50%;
  background: var(--sea);
}

.story__pic--2::after {
  border-radius: 6px;
  background: var(--leaf);
}

.story__pic--3 {
  background: var(--sun-soft);
}

.story__pic--3::after {
  background: var(--sun);
  inset: 1rem 0.7rem;
  border-radius: 999px;
}

.story__pic--4::after {
  inset: 0.9rem;
  border-radius: 4px 50% 50% 50%;
}

.story__pic--5 {
  background: var(--leaf-soft);
}

.story__pic--5::after {
  background: var(--leaf);
}

/* Helplines ----------------------------------------------------------------------------- */

.helplines {
  list-style: none;
  margin: 0;
  padding: 0;
}

.helpline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.9rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
}

.helpline:last-child {
  border-bottom: 0;
}

.helpline__number {
  font-size: 1.6rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  text-decoration: none;
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
}

.helpline--first .helpline__number {
  font-size: 2.2rem;
}

.urgent__text {
  font-weight: 600;
  font-size: 1.25rem;
}

.urgent__number {
  display: inline-block;
  font-size: 3rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.1;
  margin-bottom: 0.3rem;
}

/* Forms ------------------------------------------------------------------------------------ */

.form .field,
.form .choices,
.form .check {
  margin-bottom: 1.2rem;
}

.field__label,
.choices__legend {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  font-size: 1.15rem;
}

.field__help {
  color: var(--muted);
  font-size: 1rem;
  margin: -0.2rem 0 0.4rem;
}

.field-error {
  color: var(--plum);
  font-weight: 600;
  margin: 0 0 0.4rem;
}

input[type="text"],
input[type="email"],
input[type="search"],
input[type="number"],
input[type="tel"],
select,
textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 2px solid var(--line-strong);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  min-height: 3.25rem;
}

textarea {
  min-height: 9rem;
  resize: vertical;
}

input[type="file"] {
  font: inherit;
  font-size: 1rem;
  max-width: 100%;
}

input[type="file"]::file-selector-button {
  font: inherit;
  font-weight: 600;
  min-height: 3rem;
  margin-right: 0.8rem;
  padding: 0.4rem 1.1rem;
  border-radius: 999px;
  border: 2px solid var(--sea);
  background: var(--card);
  color: var(--sea);
  cursor: pointer;
}

.field--error input,
.field--error select,
.field--error textarea {
  border-color: var(--plum);
}

.choices {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.card.choices {
  padding: 1.1rem;
}

.choices__list {
  display: grid;
  gap: 0.5rem;
}

@media (min-width: 600px) {
  .choices--2 .choices__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .choices--3 .choices__list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .choices--4 .choices__list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .choices--5 .choices__list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.choice {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 3.25rem;
  padding: 0.55rem 0.85rem;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  cursor: pointer;
}

.choice:hover {
  border-color: var(--sea);
}

.choice:has(input:checked) {
  border-color: var(--sea);
  background: var(--sea-soft);
  font-weight: 600;
}

.choice input {
  width: 1.4rem;
  height: 1.4rem;
  flex: none;
  accent-color: var(--sea);
  margin: 0;
}

.choice--block .choice__label {
  display: flex;
  flex-direction: column;
}

.choices--error,
.map-row--error {
  border-color: var(--plum);
}

.check {
  padding: 1rem;
  border-radius: 14px;
  background: var(--bg);
}

.check--own {
  background: var(--sun-soft);
}

.check--error {
  outline: 2px solid var(--plum);
}

.check__title {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.check__label {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  cursor: pointer;
}

.check__label input {
  width: 1.6rem;
  height: 1.6rem;
  flex: none;
  margin-top: 0.15rem;
  accent-color: var(--sea);
}

.search__row {
  display: flex;
  gap: 0.5rem;
}

.search__row input {
  flex: 1 1 auto;
  min-width: 0;
}

/* Interview ----------------------------------------------------------------------------------- */

.meter {
  margin-bottom: 1rem;
}

.meter__label {
  display: block;
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.meter__bar {
  appearance: none;
  width: 100%;
  height: 0.75rem;
  border: 0;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.meter__bar::-webkit-progress-bar {
  background: var(--line);
  border-radius: 999px;
}

.meter__bar::-webkit-progress-value {
  background: var(--leaf);
  border-radius: 999px;
}

.meter__bar::-moz-progress-bar {
  background: var(--leaf);
  border-radius: 999px;
}

.ask {
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.bubble {
  position: relative;
  font-size: clamp(1.35rem, 1.15rem + 1vw, 1.75rem);
  line-height: 1.35;
  background: var(--sea-soft);
  border-radius: 22px 22px 22px 6px;
  padding: 1rem 1.2rem;
  margin: 0 0 1.3rem;
}

.bubble--small {
  font-size: 1.25rem;
}

.bubble-card {
  font-size: 1.2rem;
  background: var(--sea-soft);
  border-color: transparent;
}

.quote {
  border-left: 4px solid var(--sun);
  padding-left: 0.8rem;
  color: var(--muted);
  font-style: italic;
}

.aspects {
  border-top: 1px dashed var(--line);
  padding-top: 1rem;
}

.interview__tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* Reveal follow-up fields only when they apply (no script). Without :has()
   every field stays visible and the labels say when to answer. */
@supports selector(:has(*)) {
  .item-more,
  .map-more,
  .help-more {
    display: none;
  }

  .item-form:has(input[name$="frequency"]:checked:not([value="0"])) .item-more,
  .map-row:has(input[name$="confirm"][value="yes"]:checked) .map-more,
  .help-form:has(input[name="asked"][value="yes"]:checked) .help-more {
    display: block;
  }

  .map-row:has(input[name$="confirm"][value="yes"]:checked) .map-more {
    padding-top: 0.6rem;
  }
}

/* Summary, status, files ---------------------------------------------------------------------- */

.facts,
.files,
.consents,
.due {
  list-style: none;
  margin: 0;
  padding: 0;
}

.facts__item,
.files__item,
.consents__item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.8rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}

.facts__item:last-child,
.files__item:last-child,
.consents__item:last-child {
  border-bottom: 0;
}

.facts__text {
  font-weight: 600;
  flex: 1 1 18rem;
}

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

.story-text {
  white-space: normal;
  overflow-wrap: anywhere;
}

.hash {
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.due li {
  padding: 0.35rem 0;
}

.status > :last-child {
  margin-bottom: 0;
}

.status__now {
  font-size: 1.25rem;
  font-weight: 600;
}

.case-number {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.case-number--big {
  font-size: clamp(1.5rem, 1.1rem + 2vw, 2.4rem);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.done {
  text-align: center;
  padding: 2rem 1.25rem;
}

.done__title {
  font-size: clamp(1.7rem, 1.3rem + 2vw, 2.5rem);
}

.pairs {
  display: grid;
  grid-template-columns: minmax(0, 9rem) minmax(0, 1fr);
  gap: 0.4rem 1rem;
  margin: 0;
}

.pairs dt {
  font-weight: 600;
}

.pairs dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.tag {
  display: inline-block;
  font-size: 0.9rem;
  padding: 0.05rem 0.6rem;
  border-radius: 999px;
  background: var(--leaf-soft);
  color: var(--leaf);
  font-weight: 600;
}

.delete {
  margin-top: 1rem;
}

/* Footer ---------------------------------------------------------------------------------------- */

.foot {
  background: var(--card);
  border-top: 1px solid var(--line);
  font-size: 1rem;
}

.foot__inner {
  padding-top: 1.4rem;
  padding-bottom: 1.6rem;
}

.foot__links {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.1rem;
}

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

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

.foot__notice--strong {
  color: var(--ink);
  font-weight: 600;
}

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

@media (prefers-reduced-motion: no-preference) {
  .button,
  .choice,
  .tile {
    transition:
      background-color 0.15s ease,
      border-color 0.15s ease;
  }
}
