:root {
  --nhs-blue: #005eb8;
  --nhs-dark-blue: #003087;
  --nhs-text: #212b32;
  --nhs-secondary-text: #4c6272;
  --nhs-pale-grey: #f0f4f5;
  --nhs-border: #d8dde0;
  --nhs-yellow: #ffeb3b;
  --nhs-warm-yellow: #fff9c4;
  --radius: 6px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 18px; }
body {
  font-family: "Frutiger W01", Arial, "Helvetica Neue", Helvetica, sans-serif;
  background: var(--nhs-pale-grey);
  color: var(--nhs-text);
  line-height: 1.5;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
}

.app {
  width: 100%;
  max-width: 720px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-left: 1px solid var(--nhs-border);
  border-right: 1px solid var(--nhs-border);
}

/* Header */
header {
  background: var(--nhs-blue);
  color: #fff;
  padding: 14px 20px;
}
header .toprow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
header h1 { font-size: 1.2rem; font-weight: 700; }
header .subtitle { font-size: 0.85rem; opacity: 0.95; margin-top: 2px; }
.header-actions { display: flex; gap: 8px; }
.header-actions a, .header-actions button {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.7);
  color: #fff;
  font: inherit;
  font-size: 0.8rem;
  padding: 4px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
}
.header-actions a:hover, .header-actions button:hover { background: rgba(255,255,255,0.15); }

.disclaimer {
  background: var(--nhs-warm-yellow);
  border-bottom: 1px solid var(--nhs-border);
  padding: 10px 20px;
  font-size: 0.85rem;
  color: var(--nhs-text);
}

/* Search */
.search-wrap {
  padding: 16px 20px 4px;
}
.search-wrap label {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
  font-size: 0.95rem;
}
.search-box { display: flex; }
#searchInput {
  flex: 1;
  font: inherit;
  padding: 10px 12px;
  border: 2px solid var(--nhs-text);
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  min-width: 0;
}
#searchBtn {
  background: var(--nhs-blue);
  color: #fff;
  border: 2px solid var(--nhs-blue);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0 18px;
  font: inherit;
  cursor: pointer;
}
#searchBtn:hover { background: var(--nhs-dark-blue); border-color: var(--nhs-dark-blue); }
.search-results {
  margin-top: 10px;
  display: none;
}
.search-results.active { display: block; }
.search-results h2 { font-size: 0.9rem; color: var(--nhs-secondary-text); font-weight: 700; margin-bottom: 6px; }
.no-results { color: var(--nhs-secondary-text); font-size: 0.9rem; font-style: italic; }

/* Breadcrumb */
nav.crumbs {
  padding: 10px 20px 0;
  font-size: 0.85rem;
  color: var(--nhs-secondary-text);
  display: none;
}
nav.crumbs.active { display: block; }
nav.crumbs button {
  background: none;
  border: none;
  font: inherit;
  color: var(--nhs-blue);
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}
nav.crumbs .sep { margin: 0 6px; }
nav.crumbs .current { color: var(--nhs-text); font-weight: 700; }

/* Content */
main {
  flex: 1;
  padding: 16px 20px 24px;
}
.card {
  border: 1px solid var(--nhs-border);
  border-left: 4px solid var(--nhs-blue);
  border-radius: var(--radius);
  padding: 18px 20px;
  animation: appear 0.25s ease-out;
}
@keyframes appear {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .card { animation: none; }
}
.card p { margin-bottom: 0.7em; }
.card p:last-child { margin-bottom: 0; }
.card ul { margin: 0 0 0.7em 1.2em; }
.card strong { color: var(--nhs-dark-blue); }
.card a { color: var(--nhs-blue); font-weight: 700; }

.followups { margin-top: 18px; }
.followups h2 {
  font-size: 0.9rem;
  color: var(--nhs-secondary-text);
  font-weight: 700;
  margin-bottom: 8px;
}
.btn-list { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.btn-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.topic-btn {
  background: #fff;
  border: 1px solid var(--nhs-blue);
  color: var(--nhs-blue);
  font: inherit;
  font-size: 0.95rem;
  text-align: left;
  padding: 10px 14px;
  border-radius: var(--radius);
  cursor: pointer;
}
.topic-btn:hover { background: var(--nhs-blue); color: #fff; }
.topic-btn.primary {
  background: var(--nhs-blue);
  color: #fff;
  font-weight: 700;
}
.topic-btn.primary:hover { background: var(--nhs-dark-blue); border-color: var(--nhs-dark-blue); }

.home-intro { margin-bottom: 14px; }

.back-btn {
  margin-top: 18px;
  background: none;
  border: none;
  font: inherit;
  color: var(--nhs-blue);
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

footer {
  padding: 12px 20px;
  border-top: 1px solid var(--nhs-border);
  font-size: 0.8rem;
  color: var(--nhs-secondary-text);
}

/* Focus visibility (NHS-style) */
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid transparent;
  box-shadow: 0 0 0 3px var(--nhs-yellow), 0 0 0 6px var(--nhs-text);
  z-index: 1;
  position: relative;
}

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