/* Near the BRI – simple, high-contrast, phone-first styles.
   Warm colour scheme (cream, amber, brown); deliberately avoids the NHS blue identity. */
:root {
  --bg: #fff6e8;         /* warm cream page */
  --card: #ffffff;
  --ink: #1b1b1b;
  --muted: #4a4a4a;
  --line: #ebd3b0;
  --brand: #f9bf5b;      /* warm amber header and buttons */
  --brand-edge: #d4861c;
  --brand-ink: #1b1b1b;  /* dark text on yellow */
  --brand-soft: #ffe8c9;
  --link: #7a3300;       /* warm brown links */
  --focus: #1b1b1b;
  --urgent: #a4161a;
  --urgent-soft: #fdeceb;
  --radius: 12px;
  color-scheme: light;
  font-size: 112.5%; /* 18px base */
}
/* Dark colours: used when the phone is in dark mode (unless the person picked light
   with the sun/moon button), or when they picked dark with the button. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a120c; --card: #271b12; --ink: #f7efe6; --muted: #d6c6b4; --line: #553b26;
    --brand: #f5b04a; --brand-edge: #f5b04a; --brand-ink: #1b1b1b; --brand-soft: #3d2816; --link: #ffc27a;
    --focus: #ffffff; --urgent: #ff8a80; --urgent-soft: #3a1c1b;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1a120c; --card: #271b12; --ink: #f7efe6; --muted: #d6c6b4; --line: #553b26;
  --brand: #f5b04a; --brand-edge: #f5b04a; --brand-ink: #1b1b1b; --brand-soft: #3d2816; --link: #ffc27a;
  --focus: #ffffff; --urgent: #ff8a80; --urgent-soft: #3a1c1b;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.5;
}
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.wrap { max-width: 46rem; margin: 0 auto; padding: 0 16px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -200px; background: var(--brand); color: #000; padding: 12px; z-index: 10; }
.skip:focus { top: 8px; }

.top { background: var(--brand); color: var(--brand-ink); border-bottom: 2px solid var(--brand-edge); }
.top .wrap { padding-top: 12px; padding-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.theme-toggle {
  flex: 0 0 auto; width: 48px; height: 48px; min-height: 48px; padding: 0; border-radius: 50%;
  background: rgba(255,255,255,.55); color: var(--brand-ink); border: 2px solid var(--brand-edge);
}
.theme-toggle svg { width: 26px; height: 26px; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand-mark { display: inline-flex; background: rgba(255,255,255,.55); border-radius: 50%; padding: 6px; }
.brand-name { display: block; font-weight: 800; font-size: 1.3rem; line-height: 1.1; }
.brand-sub { display: block; font-size: .85rem; opacity: .95; }

.independent { background: var(--brand-soft); border-left: 5px solid var(--brand-edge); padding: 10px 12px; margin: 16px 0; border-radius: 6px; font-size: .95rem; }

.search label { display: block; font-weight: 700; margin-bottom: 6px; }
.search-row { display: flex; gap: 8px; }
.search input {
  flex: 1; min-width: 0; font: inherit; font-size: 1.05rem; padding: 12px; min-height: 52px;
  border: 2px solid var(--ink); border-radius: var(--radius); background: var(--card); color: var(--ink);
}
button, .btn {
  font: inherit; font-weight: 700; cursor: pointer; min-height: 48px; padding: 10px 16px;
  border-radius: var(--radius); border: 2px solid var(--brand-edge); background: var(--brand); color: var(--brand-ink);
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-align: center;
}
.btn.secondary, button.secondary { background: var(--card); color: var(--link); border-color: var(--line); }
.section-title { font-size: 1.25rem; margin: 24px 0 10px; }

.cats { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cats button {
  width: 100%; min-height: 96px; flex-direction: column; background: var(--card); color: var(--ink);
  border: 2px solid var(--line); font-size: 1rem; line-height: 1.25; padding: 12px 8px;
}
.cats button:hover { border-color: var(--brand-edge); }
.cats .ic { font-size: 1.9rem; line-height: 1; }
.cats .sub { font-weight: 400; font-size: .8rem; color: var(--muted); }
@media (min-width: 600px) { .cats { grid-template-columns: repeat(3, 1fr); } }

.results-head h2 { font-size: 1.5rem; margin: 12px 0 4px; }
.back { background: transparent; color: var(--link); border: 0; padding: 8px 0; text-decoration: underline; min-height: 44px; margin-top: 8px; }
.intro { color: var(--muted); margin: 0 0 12px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.filters button { min-height: 44px; padding: 6px 14px; background: var(--card); color: var(--ink); border: 2px solid var(--line); font-weight: 600; }
.filters button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand-edge); }

.map-box { margin: 8px 0 12px; background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); }
.map-box summary { cursor: pointer; padding: 12px 14px; font-weight: 700; min-height: 48px; color: var(--link); }
#map { height: 300px; background: #ddd; }
.map-box .small { margin: 6px 12px 10px; }
.small { font-size: .85rem; color: var(--muted); }
.count { font-weight: 700; margin: 8px 0; }

.list { list-style: none; padding: 0; margin: 0; }
.card {
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px;
}
.card h3 { margin: 0; font-size: 1.15rem; line-height: 1.3; }
.card .meta { margin: 2px 0 6px; color: var(--muted); }
.card .dist { font-weight: 700; color: var(--ink); }
.card p { margin: 6px 0; }
.card .hours { font-size: .9rem; }
.card .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.card .actions .btn { flex: 1 1 7rem; font-size: .95rem; padding: 8px 10px; }
.card .dirs { margin: 10px 0 0; font-size: .85rem; color: var(--muted); }
.tag { display: inline-block; font-size: .8rem; font-weight: 700; border-radius: 999px; padding: 2px 10px; background: var(--brand-soft); color: var(--ink); margin-right: 4px; }
.more { width: 100%; margin: 4px 0 16px; }

.guide-card { background: var(--brand-soft); border: 2px solid var(--brand-edge); }
.guide-card ul { padding-left: 1.2rem; margin: 6px 0; }
.guide-card li { margin: 4px 0; }
.note { background: #fff1dc; color: #1b1b1b; border-left: 5px solid #b5530a; padding: 10px 12px; border-radius: 6px; margin: 0 0 12px; }

.help { margin: 28px 0 16px; padding: 14px; background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); }
.help h2 { margin-top: 0; font-size: 1.2rem; }
.help-list { padding-left: 1.2rem; margin: 0; }
.help-list li { margin: 8px 0; }
.help-list .urgent { color: var(--urgent); font-size: 1.1rem; }
.help-list .urgent a { color: var(--urgent); font-weight: 800; }
.disclaimer { font-size: .95rem; color: var(--muted); margin-bottom: 24px; }
.disclaimer h2 { font-size: 1.1rem; color: var(--ink); }
.foot { border-top: 1px solid var(--line); padding: 12px 0 24px; font-size: .85rem; color: var(--muted); }
.noscript { background: var(--urgent-soft); padding: 12px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print { .search, .cats, .filters, .map-box, .actions, .more, .back { display: none !important; } }
#resultsTitle:focus { outline: none; box-shadow: none; }
.card .floor { font-size: 1.1rem; margin: 6px 0 2px; }
.fixed { background: var(--brand-soft); border-left: 5px solid var(--brand-edge); padding: 8px 12px; border-radius: 6px; }
.langbar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin: 12px 0 0; flex-wrap: wrap; }
.langbar label { font-weight: 700; }
.langbar select {
  font: inherit; min-height: 44px; padding: 6px 10px; border-radius: var(--radius);
  border: 2px solid var(--line); background: var(--card); color: var(--ink);
}
.machine { font-size: .9rem; color: var(--muted); margin: 8px 0 0; }
/* Right-to-left languages (Arabic, Urdu) */
[dir="rtl"] .independent, [dir="rtl"] .note, [dir="rtl"] .fixed { border-left: 0; border-right: 5px solid var(--brand-edge); }
[dir="rtl"] .note { border-right-color: #b5530a; }
[dir="rtl"] .help-list, [dir="rtl"] .guide-card ul { padding-left: 0; padding-right: 1.2rem; }
[dir="rtl"] .langbar { justify-content: flex-start; }

/* Bigger text (A+ button) */
html.big { font-size: 137.5%; }
.top-buttons { display: flex; gap: 8px; flex: 0 0 auto; }
.text-toggle { font-size: 1rem; font-weight: 800; }
html.big .text-toggle { background: var(--card); }
html.big .cats { grid-template-columns: 1fr; }
/* Open now / closed now */
.tag.open { background: #d8f0dd; color: #14532d; }
.tag.closed { background: #f5e1df; color: #7a1a12; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tag.open { background: #1e3a26; color: #b6ecc4; } :root:not([data-theme="light"]) .tag.closed { background: #3d1f1c; color: #ffc4bc; } }
:root[data-theme="dark"] .tag.open { background: #1e3a26; color: #b6ecc4; }
:root[data-theme="dark"] .tag.closed { background: #3d1f1c; color: #ffc4bc; }

/* Children's Hospital level colours (shown next to the level number, never instead of it) */
.lvl { display: inline-block; width: 0.9em; height: 0.9em; border-radius: 3px; margin: 0 0.25em 0 0.5em;
  vertical-align: -0.1em; border: 1px solid rgba(0,0,0,.45); }
.lvl-grey { background: #3a3a3a; } .lvl-orange { background: #f07f12; } .lvl-yellow { background: #ffd21f; }
.lvl-green { background: #2e9e3e; } .lvl-blue { background: #1f6fd1; } .lvl-purple { background: #7b3fb5; }
.loadfail { background: #fde2dc; color: #5a1205; border: 2px solid #b8321b; border-radius: 10px; padding: 12px 14px; margin: 12px 0; }
.loadfail p { margin: 0 0 8px; }
.loadfail button { font: inherit; padding: 8px 14px; border-radius: 8px; border: 2px solid #b8321b; background: #fff; color: #5a1205; cursor: pointer; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) .loadfail { background: #3d1710; color: #ffd9cf; border-color: #e0634a; } }
[data-theme=dark] .loadfail { background: #3d1710; color: #ffd9cf; border-color: #e0634a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) .lvl { border-color: rgba(255,255,255,.6); } }
[data-theme=dark] .lvl { border-color: rgba(255,255,255,.6); }
